Monday, June 8, 2020

sql recursion or recursion in sql server or go to



DECLARE @text VARCHAR(50) = NULL;
nn:
if(@text is not null)
begin
EXEC [dbo].[CreateRandomString] @minLength = 10,@maxLength = 10, @randomString = @text OUTPUT;
end
if(@text is null) begin
set @text='Pudzw6p5w'
end
if(select count(*) from product_keypin where pinkey=@text)>0
begin
print 'Duplicate'
goto nn
end else begin
print 'No Duplicate'
end;

Thursday, May 14, 2020

Delete in Linq or Delete in Linq in Array List or Delete in Linq from Array List or Update in Linq or Update in Linq in Array List or Update in Linq in Object List




var stc_list = (from x in stc_list_
                            join y in sz on new { x.ICode, x.Clr_Code, x.SzCode } equals new { y.ICode, y.Clr_Code, y.SzCode }
                            orderby x.SzSort
                            select (new v_stock_clr_sz { ICode = x.ICode, Clr_Code = x.Clr_Code, SzCode = x.SzCode, SzQty_Pur = x.SzQty_Pur, SzQty_Sale = y.SzQty, SzQty_SaleR = x.SzQty_SaleR, SzQty_PurR = x.SzQty_PurR, SzQty_StoE = x.SzQty_StoE, SzQty_Srap = x.SzQty_Srap, stock = x.stock, SzName = x.SzName, SzSort = x.SzSort, Clr_Name = x.Clr_Name, mIcode = x.mIcode, UDI_Bar = x.UDI_Bar, Item_ID = x.Item_ID, IName = x.IName, Product_Name = x.Product_Name, Product_Name_Oth = x.Product_Name_Oth, path = x.path, photo = x.photo, photo_oth = x.photo_oth, GCode = x.GCode, SzCodeG = x.SzCodeG, GName = x.GName, SzNameG = x.SzNameG, Br_Code = x.Br_Code, Br_Name = x.Br_Name, St_Code = x.St_Code, St_Name = x.St_Name, Om_Code = x.Om_Code, Om_Name = x.Om_Name, Sg_Code = x.Sg_Code, Sg_Name = x.Sg_Name, Im_Code = x.Im_Code, Im_Name = x.Im_Name, TAX = x.TAX, Detail = x.Detail, Unit = x.Unit, Tax_Code = x.Tax_Code, HSN = x.HSN, Pur_Rate = x.Pur_Rate, Sale_Rate = x.Sale_Rate, MRP = x.MRP, Edate = x.Edate, E_ID = x.E_ID, Udate = x.Udate, U_ID = x.U_ID, U_Remark = x.U_Remark })).ToList();

        foreach (var item in stc_list)
            {
                if (get_avaiable == false)
                {
                    if (((du.Valc(item.stock) - du.Valc(item.SzQty_Sale)) < 0))
                    {
                        msg = db.msg_stock_not;
                        return (st: false, msg: msg, order_Det_List);
                    }
                }
                else
                {
                    if (du.Valc(item.SzQty_Sale) < 1 || du.Valc(item.stock) < 1)
                    {
                        sz.RemoveAll(x => x.ICode == item.ICode && x.Clr_Code == item.Clr_Code && x.SzCode == item.SzCode);
                    }
                    else
                    {
                        if ((du.Valc(item.stock) - du.Valc(item.SzQty_Sale)) < 0)
                        {
                            var udata = from x in sz
                                     where x.ICode == item.ICode && x.Clr_Code == item.Clr_Code && x.SzCode == item.SzCode
                                     select x;
                            foreach (var dd in udata)
                            {
                                dd.SzQty = du.Valc(item.stock);
                            }
                        }
                    }
                }
            }

Sunday, April 5, 2020

a href # color or link color or blank link color

using with single cot or double cot

<style>
    .dropdown-menu a[href='#'] {
        background-color: yellow;
    }
</style>

Tuesday, February 25, 2020

Srno in crystal report or Serial number in crystal report or srno in formula

numberVar f_sno=0;
stringVar f_booth="";
WhileReadingRecords;

if({command.booth_no} = f_booth) then
(
f_booth := {command.booth_no};
f_sno := f_sno + 1;
)
else
(
f_booth := {command.booth_no};
f_sno :=  1;
)




Sunday, February 16, 2020

Direct landscape print in javascript or direct landscape print in jquery or direct landscape print in html


<script src="~/assets/js/jquery.min.js"></script>
<script>
    $(document).ready(function () {
        window.print();
    })
</script>
<style type="text/css" media="print">
    @page {
        size: landscape;
    }
</style>

Tuesday, January 21, 2020

Sql Server left join with group, group left join


declare @date_from date='01-mar-2020',@date_to date='31-mar-2020'
select
datediff(month,cast(c.conn_date as date),@date_from),
datediff(month,cast(c.conn_date as date),@date_from)*c.cur_tax
,*
from Consumer_Conn c
left join
(bill_det d
join bill_mas m on m.b_code=d.b_code
join
(select dd.cons_code,max(mm.date_to) date_to from bill_mas mm
join bill_det dd on mm.b_code=dd.b_code
group by dd.cons_code)as a on a.date_to=m.date_to and a.cons_code=d.cons_code
) on d.cons_code=c.cons_code



Linq Expression syntax for where condtion in linq

(Expression<Func<T, bool>> filter)