Example #1
0
        public bool DeleteTGRNDetails(TGRNDetails tgrndetails)
        {
            SqlCommand cmd;

            cmd             = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "DeleteTGRNDetails";

            cmd.Parameters.AddWithValue("@PkSrNo", tgrndetails.PkSrNo);
            if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true)
            {
                return(true);
            }
            else
            {
                tgrndetails.msg = ObjTrans.ErrorMessage;
                return(false);
            }
        }
Example #2
0
        public bool AddTGRNDetails(TGRNDetails tgrndetails)
        {
            SqlCommand cmd;

            cmd             = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "AddTGRNDetails";

            cmd.Parameters.AddWithValue("@PkSrNo", tgrndetails.PkSrNo);

            //cmd.Parameters.AddWithValue("@FkGRNNo", tgrndetails.FkGRNNo);

            cmd.Parameters.AddWithValue("@GRNSrNo", tgrndetails.GRNSrNo);

            cmd.Parameters.AddWithValue("@ItemNo", tgrndetails.ItemNo);

            cmd.Parameters.AddWithValue("@Quantity", tgrndetails.Quantity);

            cmd.Parameters.AddWithValue("@BilledQuantity", tgrndetails.BilledQuantity);

            cmd.Parameters.AddWithValue("@Rate", tgrndetails.Rate);

            cmd.Parameters.AddWithValue("@Amount", tgrndetails.Amount);

            cmd.Parameters.AddWithValue("@NetRate", tgrndetails.NetRate);

            cmd.Parameters.AddWithValue("@NetAmount", tgrndetails.NetAmount);

            cmd.Parameters.AddWithValue("@FkRateSettingNo", tgrndetails.FkRateSettingNo);

            cmd.Parameters.AddWithValue("@CompanyNo", tgrndetails.CompanyNo);

            cmd.Parameters.AddWithValue("@GodownNo", tgrndetails.GodownNo);

            cmd.Parameters.AddWithValue("@UserID", tgrndetails.UserID);

            cmd.Parameters.AddWithValue("@UserDate", tgrndetails.UserDate);

            commandcollection.Add(cmd);
            return(true);
        }
Example #3
0
        public TGRNDetails ModifyTGRNDetailsByID(long ID)
        {
            SqlConnection Con = new SqlConnection(CommonFunctions.ConStr);
            string        sql;
            SqlCommand    cmd;

            sql            = "Select * from TGRNDetails where PkSrNo =" + ID;
            cmd            = new SqlCommand(sql, Con);
            cmd.Connection = Con;
            Con.Open();
            cmd.CommandType = CommandType.Text;
            SqlDataReader dr;

            dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            if (dr.HasRows)
            {
                TGRNDetails MM = new TGRNDetails();
                while (dr.Read())
                {
                    MM.PkSrNo = Convert.ToInt32(dr["PkSrNo"]);
                    if (!Convert.IsDBNull(dr["FkGRNNo"]))
                    {
                        MM.FkGRNNo = Convert.ToInt64(dr["FkGRNNo"]);
                    }
                    if (!Convert.IsDBNull(dr["GRNSrNo"]))
                    {
                        MM.GRNSrNo = Convert.ToInt64(dr["GRNSrNo"]);
                    }
                    if (!Convert.IsDBNull(dr["ItemNo"]))
                    {
                        MM.ItemNo = Convert.ToInt64(dr["ItemNo"]);
                    }
                    if (!Convert.IsDBNull(dr["Quantity"]))
                    {
                        MM.Quantity = Convert.ToDouble(dr["Quantity"]);
                    }
                    if (!Convert.IsDBNull(dr["BilledQuantity"]))
                    {
                        MM.BilledQuantity = Convert.ToDouble(dr["BilledQuantity"]);
                    }
                    if (!Convert.IsDBNull(dr["Rate"]))
                    {
                        MM.Rate = Convert.ToDouble(dr["Rate"]);
                    }
                    if (!Convert.IsDBNull(dr["Amount"]))
                    {
                        MM.Amount = Convert.ToDouble(dr["Amount"]);
                    }
                    if (!Convert.IsDBNull(dr["NetRate"]))
                    {
                        MM.NetRate = Convert.ToDouble(dr["NetRate"]);
                    }
                    if (!Convert.IsDBNull(dr["NetAmount"]))
                    {
                        MM.NetAmount = Convert.ToDouble(dr["NetAmount"]);
                    }
                    if (!Convert.IsDBNull(dr["FkRateSettingNo"]))
                    {
                        MM.FkRateSettingNo = Convert.ToInt64(dr["FkRateSettingNo"]);
                    }
                    if (!Convert.IsDBNull(dr["CompanyNo"]))
                    {
                        MM.CompanyNo = Convert.ToInt64(dr["CompanyNo"]);
                    }
                    if (!Convert.IsDBNull(dr["GodownNo"]))
                    {
                        MM.GodownNo = Convert.ToInt64(dr["GodownNo"]);
                    }
                    if (!Convert.IsDBNull(dr["UserID"]))
                    {
                        MM.UserID = Convert.ToInt64(dr["UserID"]);
                    }
                    if (!Convert.IsDBNull(dr["UserDate"]))
                    {
                        MM.UserDate = Convert.ToDateTime(dr["UserDate"]);
                    }
                    if (!Convert.IsDBNull(dr["ModifiedBy"]))
                    {
                        MM.ModifiedBy = Convert.ToString(dr["ModifiedBy"]);
                    }
                }
                dr.Close();
                return(MM);
            }
            else
            {
                dr.Close();
            }
            return(new TGRNDetails());
        }