예제 #1
0
        private void initConfig()
        {
            itmC                 = new ItemsCat();
            itmC.item_cat_id     = "item_cat_id";
            itmC.item_cat_code   = "item_cat_code";
            itmC.item_cat_name_e = "item_cat_name_e";
            itmC.item_cat_name_t = "item_cat_name_t";
            //tmn.status_app = "status_app";
            itmC.sort1 = "sort1";

            itmC.active      = "active";
            itmC.date_create = "date_create";
            itmC.date_modi   = "date_modi";
            itmC.date_cancel = "date_cancel";
            itmC.user_create = "user_create";
            itmC.user_modi   = "user_modi";
            itmC.user_cancel = "user_cancel";
            //tmn.status_app = "status_app";
            itmC.remark = "remark";

            itmC.table   = "b_items_cat";
            itmC.pkField = "expenses_cat_id";

            lexpnC = new List <ItemsCat>();
        }
예제 #2
0
        private void initConfig()
        {
            expnC  = new ItemsCat();
            fEdit  = new Font(xC.iniC.grdViewFontName, xC.grdViewFontSize, FontStyle.Regular);
            fEditB = new Font(xC.iniC.grdViewFontName, xC.grdViewFontSize, FontStyle.Bold);

            C1ThemeController.ApplicationTheme = xC.iniC.themeApplication;
            theme1.Theme = C1ThemeController.ApplicationTheme;
            theme1.SetTheme(sB, "BeigeOne");
            foreach (Control c in panel3.Controls)
            {
                theme1.SetTheme(c, "Office2013Red");
            }

            bg = txtCode.BackColor;
            fc = txtCode.ForeColor;
            ff = txtCode.Font;

            txtPasswordVoid.KeyUp += TxtPasswordVoid_KeyUp;
            btnNew.Click          += BtnNew_Click;
            btnEdit.Click         += BtnEdit_Click;
            btnSave.Click         += BtnSave_Click;

            initGrfDept();
            setGrfDeptH();
            setControlEnable(false);
            setFocusColor();
            sB1.Text = "";
            btnVoid.Hide();
            txtPasswordVoid.Hide();
            stt = new C1SuperTooltip();
            sep = new C1SuperErrorProvider();
            //stt.BackgroundGradient = C1.Win.C1SuperTooltip.BackgroundGradient.Gold;
        }
예제 #3
0
        public String update(ItemsCat p, String userId)
        {
            String re  = "";
            String sql = "";
            int    chk = 0;

            chkNull(p);

            sql = "Update " + itmC.table + " Set " +
                  " " + itmC.item_cat_code + " = '" + p.item_cat_code + "'" +
                  "," + itmC.item_cat_name_e + " = '" + p.item_cat_name_e.Replace("'", "''") + "'" +
                  "," + itmC.item_cat_name_t + " = '" + p.item_cat_name_t.Replace("'", "''") + "'" +
                  "," + itmC.remark + " = '" + p.remark.Replace("'", "''") + "'" +
                  "," + itmC.date_modi + " = now()" +
                  "," + itmC.user_modi + " = '" + userId + "' " +
                  "," + itmC.sort1 + " = '" + p.sort1 + "' " +
                  //"," + tmn.status_app + " = '" + p.status_app + "' " +
                  "Where " + itmC.pkField + "='" + p.item_cat_id + "'"
            ;

            try
            {
                re = conn.ExecuteNonQuery(conn.conn, sql);
            }
            catch (Exception ex)
            {
                sql = ex.Message + " " + ex.InnerException;
            }

            return(re);
        }
예제 #4
0
        public String insert(ItemsCat p, String userId)
        {
            String re  = "";
            String sql = "";

            p.active = "1";
            //p.ssdata_id = "";
            int chk = 0;

            chkNull(p);
            //p.prefix_id = int.TryParse(p.prefix_id, out chk) ? chk.ToString() : "0";
            //p.dept_id = int.TryParse(p.dept_id, out chk) ? chk.ToString() : "0";

            sql = "Insert Into " + itmC.table + "(" + itmC.item_cat_code + "," + itmC.item_cat_name_e + "," + itmC.item_cat_name_t + "," +
                  itmC.date_create + "," + itmC.date_modi + "," + itmC.date_cancel + "," +
                  itmC.user_create + "," + itmC.user_modi + "," + itmC.user_cancel + "," +
                  itmC.active + "," + itmC.remark + ", " + itmC.sort1 + " " +
                  ") " +
                  "Values ('" + p.item_cat_code + "','" + p.item_cat_name_e.Replace("'", "''") + "','" + p.item_cat_name_t.Replace("'", "''") + "'," +
                  "'" + p.date_create + "','" + p.date_modi + "','" + p.date_cancel + "'," +
                  "'" + userId + "','" + p.user_modi + "','" + p.user_cancel + "'," +
                  "'" + p.active + "','" + p.remark.Replace("'", "''") + "','" + p.sort1 + "' " +
                  ")";
            try
            {
                re = conn.ExecuteNonQuery(conn.conn, sql);
            }
            catch (Exception ex)
            {
                sql = ex.Message + " " + ex.InnerException;
            }

            return(re);
        }
예제 #5
0
 private void setControl(String deptId)
 {
     expnC           = xC.iniDB.itmcDB.selectByPk1(deptId);
     txtID.Value     = expnC.item_cat_id;
     txtCode.Value   = expnC.item_cat_code;
     txtNameT.Value  = expnC.item_cat_name_t;
     txtRemark.Value = expnC.remark;
 }
예제 #6
0
        public ItemsCat selectByPk1(String copId)
        {
            ItemsCat  cop1 = new ItemsCat();
            DataTable dt   = new DataTable();
            String    sql  = "select expC.* " +
                             "From " + itmC.table + " expC " +
                             //"Left Join t_ssdata_visit ssv On ssv.ssdata_visit_id = bd.ssdata_visit_id " +
                             "Where expC." + itmC.pkField + " ='" + copId + "' ";

            dt   = conn.selectData(conn.conn, sql);
            cop1 = setExpenseCat(dt);
            return(cop1);
        }
예제 #7
0
        public String insertExpenseCat(ItemsCat p, String userId)
        {
            String re = "";

            if (p.item_cat_id.Equals(""))
            {
                re = insert(p, userId);
            }
            else
            {
                re = update(p, userId);
            }

            return(re);
        }
예제 #8
0
        private void chkNull(ItemsCat p)
        {
            int     chk  = 0;
            Decimal chk1 = 0;

            p.date_modi       = p.date_modi == null ? "" : p.date_modi;
            p.date_cancel     = p.date_cancel == null ? "" : p.date_cancel;
            p.user_create     = p.user_create == null ? "" : p.user_create;
            p.user_modi       = p.user_modi == null ? "" : p.user_modi;
            p.user_cancel     = p.user_cancel == null ? "" : p.user_cancel;
            p.item_cat_code   = p.item_cat_code == null ? "" : p.item_cat_code;
            p.item_cat_name_e = p.item_cat_name_e == null ? "" : p.item_cat_name_e;
            p.item_cat_name_t = p.item_cat_name_t == null ? "" : p.item_cat_name_t;
            p.remark          = p.remark == null ? "" : p.remark;
            p.sort1           = p.sort1 == null ? "" : p.sort1;
        }
예제 #9
0
        public void getlexpnC()
        {
            //lDept = new List<Department>();

            DataTable dt = new DataTable();

            dt = selectAll();
            foreach (DataRow row in dt.Rows)
            {
                ItemsCat curr1 = new ItemsCat();
                curr1.item_cat_id     = row[itmC.item_cat_id].ToString();
                curr1.item_cat_code   = row[itmC.item_cat_code].ToString();
                curr1.item_cat_name_e = row[itmC.item_cat_name_e].ToString();
                curr1.item_cat_name_t = row[itmC.item_cat_name_t].ToString();
                lexpnC.Add(curr1);
            }
        }
예제 #10
0
        public ItemsCat setExpenseCat(DataTable dt)
        {
            ItemsCat curr1 = new ItemsCat();

            if (dt.Rows.Count > 0)
            {
                curr1.item_cat_id     = dt.Rows[0][itmC.item_cat_id].ToString();
                curr1.item_cat_code   = dt.Rows[0][itmC.item_cat_code].ToString();
                curr1.item_cat_name_e = dt.Rows[0][itmC.item_cat_name_e].ToString();
                curr1.item_cat_name_t = dt.Rows[0][itmC.item_cat_name_t].ToString();
                curr1.active          = dt.Rows[0][itmC.active].ToString();
                curr1.date_cancel     = dt.Rows[0][itmC.date_cancel].ToString();
                curr1.date_create     = dt.Rows[0][itmC.date_create].ToString();
                curr1.date_modi       = dt.Rows[0][itmC.date_modi].ToString();
                curr1.user_cancel     = dt.Rows[0][itmC.user_cancel].ToString();
                curr1.user_create     = dt.Rows[0][itmC.user_create].ToString();
                curr1.user_modi       = dt.Rows[0][itmC.user_modi].ToString();
                //pti1.status_app = dt.Rows[0][tmn.status_app].ToString();
                curr1.remark = dt.Rows[0][itmC.remark].ToString();
                curr1.sort1  = dt.Rows[0][itmC.sort1].ToString();
            }

            return(curr1);
        }
예제 #11
0
        public Config()
        {
            //read config file
            try
            {
                XmlDocument xDoc = new XmlDocument();
                xDoc.Load("Config/config.xml");

                if (xDoc != null)
                {
                    /*
                     * string sim = xDoc.SelectSingleNode("Configuration/General/Simulator").InnerXml.ToString();
                     * bSimulator = (sim == "true") ? true : false;
                     * string poll = xDoc.SelectSingleNode("Configuration/General/LogPoll").InnerXml.ToString();
                     * bLogPoll = (poll == "true") ? true : false;
                     * //WGT data
                     * IP = xDoc.SelectSingleNode("Configuration/General/WGT/IP").InnerXml.ToString();
                     * port = Int32.Parse(xDoc.SelectSingleNode("Configuration/General/WGT/Port").InnerXml.ToString());
                     * Addr = Convert.ToInt32(xDoc.SelectSingleNode("Configuration/General/WGT/Addr").InnerXml.ToString(), 16);
                     * PPV1 = Double.Parse(xDoc.SelectSingleNode("Configuration/General/PPV1").InnerXml.ToString());
                     * PPV2 = Double.Parse(xDoc.SelectSingleNode("Configuration/General/PPV2").InnerXml.ToString());
                     * flowrate = Double.Parse(xDoc.SelectSingleNode("Configuration/General/FlowRate").InnerXml.ToString());
                     * PumpAuthDelay = Int32.Parse(xDoc.SelectSingleNode("Configuration/General/PumpAuthDelay").InnerXml.ToString());
                     * HOAuthDelay = Int32.Parse(xDoc.SelectSingleNode("Configuration/General/HOAuthDelay").InnerXml.ToString());
                     * Product1 = xDoc.SelectSingleNode("Configuration/General/Prod1").InnerXml.ToString();
                     * Product2 = xDoc.SelectSingleNode("Configuration/General/Prod2").InnerXml.ToString();
                     * Units = xDoc.SelectSingleNode("Configuration/General/Units").InnerXml.ToString();
                     *
                     * LimitText = xDoc.SelectSingleNode("Configuration/General/LimitText").InnerXml.ToString();
                     * PlateText = xDoc.SelectSingleNode("Configuration/General/PlateText").InnerXml.ToString();
                     * LimitPerVolText = xDoc.SelectSingleNode("Configuration/General/LimitPerVolText").InnerXml.ToString();
                     * LimitPerMoneyText = xDoc.SelectSingleNode("Configuration/General/LimitPerMoneyText").InnerXml.ToString();
                     */



                    // Get items cat
                    //XmlNode node = xDoc.SelectSingleNode("Configuration/Devices").FirstChild.ChildNodes;
                    //xDoc.SelectSingleNode("Configuration/ItemsCat").ChildNodes.Item(0).SelectSingleNode("Items").SelectSingleNode("Item")
                    XmlNodeList node = xDoc.SelectNodes("Configuration/ItemsCat/Cat");
                    foreach (XmlNode node3 in node)
                    {
                        ItemsCat ic = new ItemsCat();
                        ic.items = new List <Item>();
                        ic.Name  = node3.SelectSingleNode("Name").InnerText;

                        XmlNodeList cat = node3.SelectNodes("Items/Item");

                        foreach (XmlNode am in cat)
                        {
                            Item item = new Item();
                            item.Code  = int.Parse(am.SelectSingleNode("Code").InnerText);
                            item.Name  = am.SelectSingleNode("Name").InnerText;
                            item.price = double.Parse(am.SelectSingleNode("Price").InnerText);
                            ic.items.Add(item);
                        }

                        itemscat.Add(ic);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error reading configuration file. " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }