示例#1
0
        private void OnDisplayMembers(string companyGUID)
        {
            Result result = CompanyBus.GetCompanyMemberList(companyGUID);

            if (result.IsOK)
            {
                MethodInvoker method = delegate
                {
                    dgMembers.DataSource = result.QueryResult;
                };

                if (InvokeRequired)
                {
                    BeginInvoke(method);
                }
                else
                {
                    method.Invoke();
                }
            }
            else
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("CompanyBus.GetCompanyMemberList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("CompanyBus.GetCompanyMemberList"));
            }
        }
示例#2
0
 private void OnDisplayCompanyList()
 {
     lock (ThisLock)
     {
         Result result = CompanyBus.GetCompanyList(_name);
         if (result.IsOK)
         {
             dgCompany.Invoke(new MethodInvoker(delegate()
             {
                 ClearData();
                 DataTable dt = result.QueryResult as DataTable;
                 if (_dtTemp == null)
                 {
                     _dtTemp = dt.Clone();
                 }
                 UpdateChecked(dt);
                 dgCompany.DataSource = dt;
             }));
         }
         else
         {
             MsgBox.Show(Application.ProductName, result.GetErrorAsString("CompanyBus.GetCompanyList"), IconType.Error);
             Utility.WriteToTraceLog(result.GetErrorAsString("CompanyBus.GetCompanyList"));
         }
     }
 }
示例#3
0
        private void OnDeleteCompany()
        {
            if (_dictCongTys == null)
            {
                return;
            }
            List <DataRow> deletedRows    = _dictCongTys.Values.ToList <DataRow>();
            List <string>  deletedComList = new List <string>();

            foreach (DataRow row in deletedRows)
            {
                deletedComList.Add(row["CompanyGUID"].ToString());
            }

            if (deletedComList.Count > 0)
            {
                if (MsgBox.Question(Application.ProductName, "Bạn có muốn xóa những công ty mà bạn đã đánh dấu ?") == DialogResult.Yes)
                {
                    Result result = CompanyBus.DeleteCompany(deletedComList);
                    if (result.IsOK)
                    {
                        DataTable dt = dgCompany.DataSource as DataTable;
                        if (dt == null || dt.Rows.Count <= 0)
                        {
                            return;
                        }

                        foreach (string key in deletedComList)
                        {
                            DataRow[] rows = dt.Select(string.Format("CompanyGUID='{0}'", key));
                            if (rows == null || rows.Length <= 0)
                            {
                                continue;
                            }
                            dt.Rows.Remove(rows[0]);
                        }

                        _dictCongTys.Clear();
                        _dtTemp.Rows.Clear();
                    }
                    else
                    {
                        MsgBox.Show(Application.ProductName, result.GetErrorAsString("CompanyBus.DeleteCompany"), IconType.Error);
                        Utility.WriteToTraceLog(result.GetErrorAsString("CompanyBus.DeleteCompany"));
                    }
                }
            }
            else
            {
                MsgBox.Show(Application.ProductName, "Vui lòng đánh dấu những công ty cần xóa.", IconType.Information);
            }
        }
示例#4
0
 private void LoadCompanyInfo(string CompanyCD)
 {
     if (string.IsNullOrEmpty(CompanyCD))
     {
         return;
     }
     try
     {
         string    StrWhere = " CompanyCD='" + CompanyCD + "'";
         DataTable dt       = CompanyBus.GetCompanyByCD(StrWhere);
         if (dt != null && dt.Rows.Count > 0)
         {
             foreach (DataRow Row in dt.Rows)
             {
                 this.txtCompanyCD.Text     = Row["CompanyCD"] != DBNull.Value?Row["CompanyCD"].ToString():"";
                 this.txtCompanyCn.Text     = Row["CompanyNameCn"] != DBNull.Value ? Row["CompanyNameCn"].ToString() : "";
                 this.txtCompanyEn.Text     = Row["CompanyNameEn"] != DBNull.Value ? Row["CompanyNameEn"].ToString() : "";
                 this.txtTel.Text           = Row["Tel"] != DBNull.Value ? Row["Tel"].ToString() : "";
                 this.txtFax.Text           = Row["Fax"] != DBNull.Value ? Row["Fax"].ToString(): "";
                 this.txtPost.Text          = Row["Post"] != DBNull.Value ? Row["Post"].ToString(): "";
                 this.txtHomePage.Text      = Row["HomePage"] != DBNull.Value ? Row["HomePage"].ToString() : "";
                 this.txtMail.Text          = Row["Email"] != DBNull.Value ? Row["Email"].ToString() : "";
                 this.txtQQ.Text            = Row["QQ"] != DBNull.Value ? Row["QQ"].ToString() : "";
                 this.txtMSN.Text           = Row["MSN"] != DBNull.Value ? Row["MSN"].ToString() : "";
                 this.txtIM.Text            = Row["IM"] != DBNull.Value ? Row["IM"].ToString() : "";
                 this.txtContact.Text       = Row["Contact"] != DBNull.Value?Row["Contact"].ToString():"";
                 this.txtAddress.Text       = Row["Addr"] != DBNull.Value ? Row["Addr"].ToString() : "";
                 this.txtTradeCD.Text       = Row["TradeCD"] != DBNull.Value ? Row["TradeCD"].ToString() : "";
                 this.txtStaff.Text         = Row["Staff"] != DBNull.Value ? Row["Staff"].ToString() : "";
                 this.DrpSize.SelectedValue = Row["Size"] != DBNull.Value ? Row["Size"].ToString() : "";
                 this.txtProduction.Text    = Row["Production"] != DBNull.Value ? Row["Production"].ToString() : "";
                 this.txtSale.Text          = Row["Sale"] != DBNull.Value ? Row["Sale"].ToString():"";
                 this.txtCredit.Text        = Row["Credit"] != DBNull.Value ? Row["Credit"].ToString() : "";
                 this.txtRemark.Text        = Row["Remark"] != DBNull.Value ? Row["Remark"].ToString() : "";
                 //New add
                 this.SetPro.Value = Row["ProvCD"] != DBNull.Value ? Row["ProvCD"].ToString() : "";
                 if (Row["ProvCD"] != DBNull.Value)
                 {
                     BindCity(Row["ProvCD"].ToString());
                 }
                 this.SetCity.Value = Row["CityCD"] != DBNull.Value ? Row["CityCD"].ToString() : "";
                 HideAction.Value   = Row["CityCD"].ToString();
             }
         }
     }
     catch
     {
         lblMessage.Text = "数据初始化失败,请联系管理员!";
     }
 }
示例#5
0
 protected void btnDelete_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         string Companycd = "";
         Companycd = Request.Form["hidDelete"].ToString();
         Companycd = Companycd.Remove(Companycd.Length - 1);
         CompanyBus.DelCompany(Companycd);
         InitPage(true, "");
     }
     catch
     {
         lblMessage.Text = "删除失败,请联系管理员。";
     }
 }
示例#6
0
        private void GenerateCode()
        {
            Cursor.Current = Cursors.WaitCursor;
            Result result = CompanyBus.GetCompanyCount();

            if (result.IsOK)
            {
                int count = Convert.ToInt32(result.QueryResult);
                txtMaCongTy.Text = Utility.GetCode("CTY", count + 1, 7);
            }
            else
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("CompanyBus.GetCompanyCount"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("CompanyBus.GetCompanyCount"));
            }
        }
示例#7
0
        private void OnDisplayPatientList()
        {
            lock (ThisLock)
            {
                Result result;
                if (!_isContractMember)
                {
                    result = PatientBus.GetPatientListNotInCompany(_name, _type, _doiTuong);
                }
                else
                {
                    result = CompanyBus.GetCompanyMemberListNotInContractMember(_companyGUID, _contractGUID, _name, _type, _doiTuong);
                }

                if (result.IsOK)
                {
                    dgMembers.Invoke(new MethodInvoker(delegate()
                    {
                        ClearData();

                        DataTable dt = result.QueryResult as DataTable;
                        dt           = GetDataSource(dt);
                        if (_dtTemp == null)
                        {
                            _dtTemp = dt.Clone();
                        }
                        UpdateChecked(dt);
                        dgMembers.DataSource = dt;
                    }));
                }
                else
                {
                    if (!_isContractMember)
                    {
                        MsgBox.Show(Application.ProductName, result.GetErrorAsString("PatientBus.GetPatientListNotInCompany"), IconType.Error);
                        Utility.WriteToTraceLog(result.GetErrorAsString("PatientBus.GetPatientListNotInCompany"));
                    }
                    else
                    {
                        MsgBox.Show(Application.ProductName, result.GetErrorAsString("CompanyBus.GetCompanyMemberListNotInContractMember"), IconType.Error);
                        Utility.WriteToTraceLog(result.GetErrorAsString("CompanyBus.GetCompanyMemberListNotInContractMember"));
                    }
                }
            }
        }
示例#8
0
        private void OnSaveInfo()
        {
            try
            {
                _company.MaCty     = txtMaCongTy.Text;
                _company.TenCty    = txtTenCongTy.Text;
                _company.DiaChi    = txtDiaChi.Text;
                _company.Dienthoai = txtDienThoai.Text;
                _company.Fax       = txtFax.Text;
                _company.Website   = txtWebsite.Text;
                _company.MaSoThue  = txtMaSoThue.Text;
                _company.Status    = (byte)Status.Actived;

                if (_isNew)
                {
                    _company.CreatedDate = DateTime.Now;
                    _company.CreatedBy   = Guid.Parse(Global.UserGUID);
                }
                else
                {
                    _company.UpdatedDate = DateTime.Now;
                    _company.UpdatedBy   = Guid.Parse(Global.UserGUID);
                }

                Result result = CompanyBus.InsertCompany(_company, _addedPatients, _deletedPatients);
                if (!result.IsOK)
                {
                    MsgBox.Show(this.Text, result.GetErrorAsString("CompanyBus.InsertCompany"), IconType.Error);
                    Utility.WriteToTraceLog(result.GetErrorAsString("CompanyBus.InsertCompany"));
                    this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                }
            }
            catch (Exception e)
            {
                MsgBox.Show(this.Text, e.Message, IconType.Error);
                Utility.WriteToTraceLog(e.Message);
            }
        }
示例#9
0
        private void DisplayMaDonVi()
        {
            _flag2 = false;
            Result result = CompanyBus.GetMaCongTyList();//ThongTinKhachHangBus.GetMaDonViList();

            if (result.IsOK)
            {
                DataTable dt     = result.QueryResult as DataTable;
                DataRow   newRow = dt.NewRow();
                newRow[0] = string.Empty;
                dt.Rows.InsertAt(newRow, 0);

                cboMaDonVi.DisplayMember = "MaCty"; //"MaDonVi";
                cboMaDonVi.ValueMember   = "MaCty"; //"MaDonVi";
                cboMaDonVi.DataSource    = dt;
            }
            else
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("CompanyBus.GetMaCongTyList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("CompanyBus.GetMaCongTyList"));
            }
            _flag2 = true;
        }
示例#10
0
    protected void btnModify_Click(object sender, ImageClickEventArgs e)
    {
        CompanyModel Model = new CompanyModel();

        Model.CityCD = HideAction.Value;


        Model.CompanyCD     = this.txtCompanyCD.Text.Trim();
        Model.CompanyNameCn = this.txtCompanyCn.Text.Trim();
        Model.CompanyNameEn = this.txtCompanyEn.Text.Trim();
        Model.ProvCD        = this.SetPro.Value;

        Model.Addr     = this.txtAddress.Text.Trim();
        Model.Contact  = this.txtContact.Text.Trim();
        Model.Tel      = this.txtTel.Text.Trim();
        Model.Fax      = this.txtFax.Text.Trim();
        Model.Post     = this.txtPost.Text.Trim();
        Model.HomePage = this.txtHomePage.Text.Trim();
        Model.Email    = this.txtMail.Text.Trim();
        Model.QQ       = this.txtQQ.Text.Trim();
        Model.MSN      = this.txtMSN.Text.Trim();
        Model.IM       = this.txtIM.Text.Trim();
        if (this.txtTradeCD.Text != "")
        {
            Model.TradeCD = Convert.ToInt32(this.txtTradeCD.Text);
        }
        if (this.txtStaff.Text != "")
        {
            Model.Staff = Convert.ToInt32(this.txtStaff.Text.Trim());
        }
        Model.Size       = DrpSize.SelectedValue;
        Model.Production = this.txtProduction.Text.Trim();
        if (this.txtSale.Text != "")
        {
            Model.Sale = Convert.ToDecimal(this.txtSale.Text);
        }
        Model.Credit         = this.txtCredit.Text.Trim();
        Model.Remark         = this.txtRemark.Text.Trim();
        Model.ModifiedUserID = "admin";
        try
        {
            if (Action == ActionUtil.Add.ToString())
            {
                CompanyBus.AddCompany(Model);
                string url = "Company_Query.aspx?CompanyCD=" + Model.CompanyCD;
                Response.Redirect(url);
                //Response.Write("<script language='javascript'>window.location='Company_Query.aspx'</script>");
            }
            else if (Action == ActionUtil.Edit.ToString())
            {
                bool reult = CompanyBus.ModifyCompany(Model);

                string url = "Company_Query.aspx?CompanyCD=" + Model.CompanyCD;
                Response.Redirect(url);
                //  Response.Write("<script language='javascript'>window.location='Company_Query.aspx?CompanyCD='"++"''</script>");
            }
        }
        catch
        {
            lblMessage.Text = "数据操作失败,请联系管理员!";
        }
    }
示例#11
0
        private bool CheckInfo()
        {
            if (txtMaCongTy.Text.Trim() == string.Empty)
            {
                MsgBox.Show(this.Text, "Vui lòng nhập mã công ty.", IconType.Information);
                txtMaCongTy.Focus();
                return(false);
            }

            if (txtTenCongTy.Text.Trim() == string.Empty)
            {
                MsgBox.Show(this.Text, "Vui lòng nhập tên công ty.", IconType.Information);
                txtTenCongTy.Focus();
                return(false);
            }

            string comGUID = _isNew ? string.Empty : _company.CompanyGUID.ToString();
            Result result  = CompanyBus.CheckCompanyExistCode(comGUID, txtMaCongTy.Text);

            if (result.Error.Code == ErrorCode.EXIST || result.Error.Code == ErrorCode.NOT_EXIST)
            {
                if (result.Error.Code == ErrorCode.EXIST)
                {
                    MsgBox.Show(this.Text, "Mã công ty này đã tồn tại rồi. Vui lòng nhập mã khác.", IconType.Information);
                    txtMaCongTy.Focus();
                    return(false);
                }
            }
            else
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("CompanyBus.CheckCompanyExistCode"), IconType.Error);
                return(false);
            }

            foreach (string patientGUID in _addedPatients)
            {
                result = CompanyBus.CheckMemberExist(patientGUID);

                if (result.Error.Code == ErrorCode.EXIST || result.Error.Code == ErrorCode.NOT_EXIST)
                {
                    if (result.Error.Code == ErrorCode.EXIST)
                    {
                        string fullName = GetFullName(patientGUID);
                        MsgBox.Show(this.Text, string.Format("Bệnh nhân: '{0}' đã thuộc 1 công ty khác.", fullName), IconType.Information);

                        DataTable dt = dgMembers.DataSource as DataTable;
                        if (dt != null)
                        {
                            DataRow[] rows = dt.Select(string.Format("PatientGUID='{0}'", patientGUID));
                            if (rows != null && rows.Length > 0)
                            {
                                _addedPatients.Remove(rows[0]["PatientGUID"].ToString());
                                dt.Rows.Remove(rows[0]);
                            }
                        }

                        return(false);
                    }
                }
                else
                {
                    MsgBox.Show(this.Text, result.GetErrorAsString("CompanyBus.CheckMemberExist"), IconType.Error);
                    return(false);
                }
            }

            return(true);
        }