Exemplo n.º 1
0
        public materialGroupBean getMaterialGroupByID(int id)
        {
            materialGroupBean Materialgroup = new materialGroupBean();

            try
            {
                string sql = " select * from pos.tmatr_grp where ID=@ID";
                Dictionary <string, string> parameter = new   Dictionary <string, string>();
                parameter.Add("@ID", id + "");
                List <materialGroupBean> result = getAllMaterialGroups(sql, parameter);
                Materialgroup = result[0];
            }
            catch (Exception ex)
            {
                myLog.Error(ex);
            }
            return(Materialgroup);
        }
Exemplo n.º 2
0
        public bool createItem(MaterialBean newMaterial)
        {
            bool result = false;

            try
            {
                materialGroupBean matrGrp = new materialGroupBean().getMaterialGroupByID(newMaterial.GRP_ID);
                int nextNumber            = new NumberRangeBeans().getNextNumberInRange(matrGrp.RANGE_ID);
                if (nextNumber > 0)
                {
                    string sql = " INSERT INTO pos.tmaterial(ID,COMP_ID,NAME,LONG_NAME,GRP_ID,MEASURE,MRP_LOW,MRP_HIGH,active)" +
                                 " values (@ID,@COMP_ID,@NAME,@LONG_NAME,@GRP_ID,@MEASURE,@MRP_LOW,@MRP_HIGH,@active)";
                    Dictionary <string, string> parameters = new Dictionary <string, string>();
                    parameters.Add("@ID", nextNumber + "");
                    parameters.Add("@COMP_ID", newMaterial.COMP_ID + "");
                    parameters.Add("@NAME", newMaterial.NAME);
                    parameters.Add("@LONG_NAME", newMaterial.LONG_NAME);
                    parameters.Add("@GRP_ID", newMaterial.GRP_ID + "");
                    parameters.Add("@MEASURE", newMaterial.MEASURE + "");
                    parameters.Add("@MRP_LOW", newMaterial.MRP_LOW + "");
                    parameters.Add("@MRP_HIGH", newMaterial.MRP_HIGH + "");
                    parameters.Add("@active", "1");
                    int dbStatus = new ConnectionManager().insertDeleteUpdate(sql, parameters);
                    if (dbStatus == 1)
                    {
                        result = true;
                    }
                }
                else
                {
                    myLog.Error("حدث خطا فى تسلسل الارقام للاصناف فى المخزن ");
                }
            }
            catch (Exception ex)
            {
                myLog.Error(ex);
            }
            return(result);
        }
Exemplo n.º 3
0
        public List <materialGroupBean> getAllMaterialGroups(string sql, Dictionary <string, string> parameters)
        {
            List <materialGroupBean> mat_grp_dataSource = new List <materialGroupBean>();

            try
            {
                DataTable currencyResult = new ConnectionManager().select(sql, parameters);
                for (int i = 0; i < currencyResult.Rows.Count; i++)
                {
                    materialGroupBean matr_grp_Bean = new materialGroupBean();
                    matr_grp_Bean.ID        = int.Parse(currencyResult.Rows[i]["id"].ToString());
                    matr_grp_Bean.NAME      = currencyResult.Rows[i]["name"].ToString();
                    matr_grp_Bean.LONG_NAME = currencyResult.Rows[i]["long_name"].ToString();
                    matr_grp_Bean.RANGE_ID  = int.Parse(currencyResult.Rows[i]["RANGE_ID"].ToString());
                    mat_grp_dataSource.Add(matr_grp_Bean);
                }
            }
            catch (Exception ex)
            {
                myLog.Error(ex);
            }
            return(mat_grp_dataSource);
        }