Ejemplo n.º 1
0
 private void frmCommonCode_Load(object sender, EventArgs e)
 {
     objBLL = new CommonCodeBLL();
     GetCommonTypeId();
     objSea = new CommonCode();
     objSea.CommonTypeId = string.IsNullOrEmpty(cbCommonTypeId.SelectedValue.ToString()) ? "" : cbCommonTypeId.SelectedValue.ToString();
     objSea.CommonId     = tbCommonId.Text;
     objSea.StrValue1    = tbStrValue1.Text;
     objSea.StrValue2    = tbStrValue2.Text;
     objSea.NumValue1    = tbNumValue1.Text;
     objSea.NumValue2    = tbNumValue2.Text;
 }
Ejemplo n.º 2
0
        private void btnSearch_Click(object sender, System.EventArgs e)
        {
            CurPage   = 1;
            totalPage = 1;
            //Truyen gia tri vao doi tuong objSea
            objSea = new CommonCode();
            objSea.CommonTypeId = string.IsNullOrEmpty(cbCommonTypeId.SelectedValue.ToString()) ? "" : cbCommonTypeId.SelectedValue.ToString();
            objSea.CommonId     = tbCommonId.Text;
            //  objSea.ParentId = cbParent.SelectedValue.ToString();
            objSea.StrValue1 = tbStrValue1.Text;
            objSea.StrValue2 = tbStrValue2.Text;
            objSea.NumValue1 = tbNumValue1.Text;
            objSea.NumValue2 = tbNumValue2.Text;

            SearchCommonCode(1);
        }
Ejemplo n.º 3
0
        private void SaveData()
        {
            string objCtId = cbCommonTypeId.SelectedValue.ToString();
            string objCId  = tbCommonId.Text;

            CommonCode obj      = new CommonCode();
            string     parentId = "";

            obj = objBLL.GetCommonCodeById(objCtId, objCId);
            if (obj != null)
            {
                parentId = obj.ParentId.ToString();
            }
            objSea = new CommonCode();
            objSea.CommonTypeId = cbCommonTypeId.SelectedValue.ToString();
            objSea.CommonId     = tbCommonId.Text;
            if (cbParent.SelectedValue.ToString() != "")
            {
                string[] lines = Regex.Split(cbParent.SelectedValue.ToString(), ",");
                objSea.ParentId = lines[1];
            }
            else
            {
                objSea.ParentId = "";
            }
            objSea.StrValue1 = tbStrValue1.Text;
            objSea.StrValue2 = tbStrValue2.Text;
            objSea.NumValue1 = tbNumValue1.Text;
            objSea.NumValue2 = tbNumValue2.Text;
            if (string.IsNullOrWhiteSpace(objSea.CommonTypeId) || string.IsNullOrWhiteSpace(objSea.CommonId))
            {
                CustomMessageBox.MessageBox.ShowCustomMessageBox(clsLanguages.GetResource("NotEnterTypeNameOrCommonId"),
                                                                 Common.clsLanguages.GetResource("Information"),
                                                                 Common.Config.CUSTOM_MESSAGEBOX_ICON.Information,
                                                                 Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK);
            }

            if (string.IsNullOrWhiteSpace(objSea.StrValue1))
            {
                CustomMessageBox.MessageBox.ShowCustomMessageBox(clsLanguages.GetResource("Bạn chưa điền strValue1"),
                                                                 Common.clsLanguages.GetResource("Information"),
                                                                 Common.Config.CUSTOM_MESSAGEBOX_ICON.Information,
                                                                 Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK);
            }
            else
            {
                if (obj != null)
                {
                    //cập nhật
                    if (CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("CommonCodeUpdate"),
                                                                         Common.clsLanguages.GetResource("Information"),
                                                                         Common.Config.CUSTOM_MESSAGEBOX_ICON.Information,
                                                                         Common.Config.CUSTOM_MESSAGEBOX_BUTTON.YESNO) == DialogResult.Yes)
                    {
                        objSea.CommonTypeId = obj.CommonTypeId;
                        if (objSea.ParentId != "")
                        {
                            if ((!ktdequyParent(obj.CommonTypeId, obj.CommonId, cbParent.SelectedValue.ToString())) || (cbParent.SelectedValue.ToString() == (obj.CommonTypeId.ToString() + "," + obj.CommonId.ToString())))
                            {
                                CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("StatusEmpty"),
                                                                                 Common.clsLanguages.GetResource("Information"),
                                                                                 Common.Config.CUSTOM_MESSAGEBOX_ICON.Information,
                                                                                 Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK);
                                cbParent.Focus();
                                return;
                            }
                        }
                        int i = objBLL.Update(objSea);
                        int j = objBLL.Update2(objSea, parentId);
                        if (i == 1)
                        {
                            lblTB1.Text = Common.clsLanguages.GetResource("UpdateSuccess1");
                        }
                        else
                        {
                            lblTB1.Text = Common.clsLanguages.GetResource("UpdateNoSuccess1");
                        }
                    }
                }
                else
                {
                    //thêm mới
                    if (CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("CommonCodeCreate"),
                                                                         Common.clsLanguages.GetResource("Information"),
                                                                         Common.Config.CUSTOM_MESSAGEBOX_ICON.Information,
                                                                         Common.Config.CUSTOM_MESSAGEBOX_BUTTON.YESNO) == DialogResult.Yes)
                    {
                        int i = objBLL.Insert(objSea);
                        if (i == 1)
                        {
                            lblTB1.Text = Common.clsLanguages.GetResource("InsertSuccess1");
                        }
                        else
                        {
                            lblTB1.Text = Common.clsLanguages.GetResource("InsertNoSuccess1");
                        }
                    }
                }
                SearchCommonCode(1);
            }
        }