Beispiel #1
0
        public bool DeleteTGRN(TGRN tgrn)
        {
            SqlCommand cmd;

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

            cmd.Parameters.AddWithValue("@GRNNo", tgrn.GRNNo);
            if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true)
            {
                return(true);
            }
            else
            {
                tgrn.msg = ObjTrans.ErrorMessage;
                return(false);
            }
        }
Beispiel #2
0
        public bool AddTGRN(TGRN tgrn)
        {
            SqlCommand cmd;

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

            cmd.Parameters.AddWithValue("@GRNNo", tgrn.GRNNo);

            cmd.Parameters.AddWithValue("@GRNUserNo", tgrn.GRNUserNo);

            cmd.Parameters.AddWithValue("@GRNDate", tgrn.GRNDate);

            cmd.Parameters.AddWithValue("@GRNTime", tgrn.GRNTime);

            cmd.Parameters.AddWithValue("@LedgerNo", tgrn.LedgerNo);

            cmd.Parameters.AddWithValue("@RefNo", tgrn.RefNo);

            cmd.Parameters.AddWithValue("@GRNAmount", tgrn.GRNAmount);

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

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

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

            SqlParameter outParameter = new SqlParameter();

            outParameter.ParameterName = "@ReturnID";
            outParameter.Direction     = ParameterDirection.Output;
            outParameter.DbType        = DbType.Int32;
            cmd.Parameters.Add(outParameter);

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

            sql            = "Select * from TGRN where GRNNo =" + 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)
            {
                TGRN MM = new TGRN();
                while (dr.Read())
                {
                    MM.GRNNo = Convert.ToInt32(dr["GRNNo"]);
                    if (!Convert.IsDBNull(dr["GRNUserNo"]))
                    {
                        MM.GRNUserNo = Convert.ToInt64(dr["GRNUserNo"]);
                    }
                    if (!Convert.IsDBNull(dr["GRNDate"]))
                    {
                        MM.GRNDate = Convert.ToDateTime(dr["GRNDate"]);
                    }
                    if (!Convert.IsDBNull(dr["GRNTime"]))
                    {
                        MM.GRNTime = Convert.ToDateTime(dr["GRNTime"]);
                    }
                    if (!Convert.IsDBNull(dr["LedgerNo"]))
                    {
                        MM.LedgerNo = Convert.ToInt64(dr["LedgerNo"]);
                    }
                    if (!Convert.IsDBNull(dr["RefNo"]))
                    {
                        MM.RefNo = Convert.ToString(dr["RefNo"]);
                    }
                    if (!Convert.IsDBNull(dr["GRNAmount"]))
                    {
                        MM.GRNAmount = Convert.ToDouble(dr["GRNAmount"]);
                    }
                    if (!Convert.IsDBNull(dr["CompanyNo"]))
                    {
                        MM.CompanyNo = Convert.ToInt64(dr["CompanyNo"]);
                    }
                    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"]);
                    }
                    if (!Convert.IsDBNull(dr["IsCancel"]))
                    {
                        MM.IsCancel = Convert.ToBoolean(dr["IsCancel"]);
                    }
                }
                dr.Close();
                return(MM);
            }
            else
            {
                dr.Close();
            }
            return(new TGRN());
        }