Ejemplo n.º 1
0
        public int Save()
        {
            int        Row   = 0;
            DBCon      dBCon = new DBCon();
            SqlCommand cmd   = null;

            try
            {
                string Quary = "";
                if (this.OrderID == 0)
                {
                    Quary = "Insert Into OrderItems values (@ItemID,@QTY,@Name,@Count,@Prize,@RagisID)";
                }
                else
                {
                    Quary = "Update OrderItems Set ItemID=@ItemID,QTY=@QTY,Name=@Name,Count=@Count,Prize=@Prize ,RagisID=@RagisID where OrderID=@OrderID";
                }
                cmd = new SqlCommand(Quary, dBCon.Con);
                cmd.Parameters.AddWithValue("@OrderID", this.OrderID);
                cmd.Parameters.AddWithValue("@ItemID", this.ItemID);
                cmd.Parameters.AddWithValue("@QTY", this.QTY);
                cmd.Parameters.AddWithValue("@Name", this.Name);
                cmd.Parameters.AddWithValue("@Count", this.Count);
                cmd.Parameters.AddWithValue("@Prize", this.Prize);
                cmd.Parameters.AddWithValue("@RagisID", this.RagisID);
                if (this.OrderID == 0)
                {
                    Row          = Convert.ToInt32(cmd.ExecuteScalar());
                    this.OrderID = Row;
                }
                else
                {
                    Row = cmd.ExecuteNonQuery();
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { cmd.Dispose(); dBCon.Con.Close(); }
            return(Row);
        }
Ejemplo n.º 2
0
        public int Save()
        {
            int        Row   = 0;
            DBCon      dBCon = new DBCon();
            SqlCommand cmd   = null;

            try
            {
                string Quary = "";
                if (this.OID == 0)
                {
                    Quary = "insert into Orders  values(@Create_Date,@RagisID)";
                }
                cmd = new SqlCommand(Quary, dBCon.Con);
                cmd.Parameters.AddWithValue("@OID", this.OID);
                cmd.Parameters.AddWithValue("@Create_Date", DateTime.Now);
                cmd.Parameters.AddWithValue("@RagisID", this.RagisID);
                Row = cmd.ExecuteNonQuery();
            }
            catch (Exception e) { e.ToString(); }
            finally { cmd.Dispose(); dBCon.Con.Close(); }
            return(Row);
        }
Ejemplo n.º 3
0
        public int Save()
        {
            int        Row      = 0;
            DBCon      ObjDbCon = new DBCon();
            SqlCommand cmd      = null;

            try
            {
                string Quary = "";
                if (this.CatID == 0)
                {
                    Quary = "Insert Into Category values(@Name); ";
                }
                else
                {
                    Quary = "Update Category Set Name=@Name Where CatID=@CatID";
                }
                cmd = new SqlCommand(Quary, ObjDbCon.Con);
                cmd.Parameters.AddWithValue("@CatID", this.CatID);
                cmd.Parameters.AddWithValue("@Name", this.Name);

                if (this.CatID == 0)
                {
                    Row        = Convert.ToInt32(cmd.ExecuteScalar());
                    this.CatID = Row;
                }
                else
                {
                    Row = cmd.ExecuteNonQuery();
                    //this.CategoryCatID = Row;
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { cmd.Dispose(); ObjDbCon.Con.Close(); }
            return(Row);
        }
Ejemplo n.º 4
0
        public int Save()
        {
            int        Row      = 0;
            DBCon      ObjDbCon = new DBCon();
            SqlCommand cmd      = null;

            try
            {
                string Quary = "";
                if (this.UserID == 0)
                {
                    Quary = "Insert Into UserType values(@Type); SELECT SCOPE_UserIDENTITY();";
                }
                else
                {
                    Quary = "Update UserType Set Type=@Type Where UserID=@UserID";
                }
                cmd = new SqlCommand(Quary, ObjDbCon.Con);
                cmd.Parameters.AddWithValue("@UserID", this.UserID);
                cmd.Parameters.AddWithValue("@Type", this.Type);

                if (this.UserID == 0)
                {
                    Row         = Convert.ToInt32(cmd.ExecuteScalar());
                    this.UserID = Row;
                }
                else
                {
                    Row = cmd.ExecuteNonQuery();
                    //this.CategoryUserID = Row;
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { cmd.Dispose(); ObjDbCon.Con.Close(); }
            return(Row);
        }
Ejemplo n.º 5
0
        public int Save()
        {
            int        Row   = 0;
            DBCon      dBCon = new DBCon();
            SqlCommand cmd   = null;

            try
            {
                string Quary = "";
                if (this.LoginID == 0)
                {
                    Quary = "Insert Into Login values (@UserName,@Password,@UserID,@CreateBy,@CreateDate,@UpdateBy,@UpdateDate)";
                }
                else
                {
                    Quary = "Update Login Set UserName=@UserName,Password=@Password,UserID=@UserID,CreateBy=@CreateBy,CreateDate=@CreateDate,UpdateBy=@UpdateBy,UpdateDate=@UpdateDate where LoginID=@LoginID";
                }
                cmd = new SqlCommand(Quary, dBCon.Con);
                cmd.Parameters.AddWithValue("@LoginID", this.LoginID);
                cmd.Parameters.AddWithValue("@UserName", this.UserName);
                cmd.Parameters.AddWithValue("@Password", this.Password);
                cmd.Parameters.AddWithValue("@UserID", this.UserID);
                if (this.LoginID == 0)
                {
                    Row          = Convert.ToInt32(cmd.ExecuteScalar());
                    this.LoginID = Row;
                }
                else
                {
                    Row = cmd.ExecuteNonQuery();
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { cmd.Dispose(); dBCon.Con.Close(); }
            return(Row);
        }