public CCreditLimit() { m_uuidID = System.Guid.Empty; m_objCustomer = null; m_objCompany = null; m_objCurrency = null; m_ApprovedCurrencyValue = 0; m_CurrencyValue = 0; m_ApprovedDays = 0; m_Days = 0; }
public CompanyModel(CCompany oCompany) { CompanyID = oCompany.CompanyID; Name = oCompany.Name; Address = oCompany.Address; Email = oCompany.Email; Mobile = oCompany.Mobile; MasterUsername = oCompany.MasterUsername; MasterPassword = oCompany.MasterPassword; LogoImgPath = oCompany.LogoImgPath; }
/// <summary> /// Populate business objects from the data reader /// </summary> /// <param name="dataReader">data reader</param> /// <returns>list of CCompany</returns> internal List <CCompany> PopulateObjectsFromReader(IDataReader dataReader) { List <CCompany> list = new List <CCompany>(); while (dataReader.Read()) { CCompany businessObject = new CCompany(); PopulateBusinessObjectFromReader(businessObject, dataReader); list.Add(businessObject); } return(list); }
public CCreditLimit(System.Guid uuidID, CCustomer objCustomer, CCompany objCompany, CCurrency objCurrency, double mApprovedCurrencyValue, double mCurrencyValue, int iApprovedDays, int iDays) { m_uuidID = uuidID; m_objCustomer = objCustomer; m_objCompany = objCompany; m_objCurrency = objCurrency; m_ApprovedCurrencyValue = mApprovedCurrencyValue; m_CurrencyValue = mCurrencyValue; m_ApprovedDays = iApprovedDays; m_Days = iDays; }
/// <summary> /// Добавляет в дерево строку ля указанной компании /// </summary> /// <param name="objCompany">компания</param> private void AddCompany(CCompany objCompany) { try { if (objCompany == null) { return; } System.Boolean bCompanyExists = false; foreach (DevExpress.XtraTreeList.Nodes.TreeListNode objNode in treeList.Nodes) { if (objNode.Tag == null) { continue; } if (((CCreditLimit)objNode.Tag).Company.ID.CompareTo(objCompany.ID) == 0) { bCompanyExists = true; break; } } if (bCompanyExists == false) { CCreditLimit objNewCreditLimit = new CCreditLimit(System.Guid.Empty, m_objSelectedCustomer, objCompany, (CCurrency)cboxCurrency.SelectedItem, 0, 0, 0, 0); treeList.AppendNode(new object[] { objNewCreditLimit.Company.Abbr, objNewCreditLimit.ApprovedCurrencyValue, objNewCreditLimit.ApprovedDays, objNewCreditLimit.CurrencyValue, objNewCreditLimit.Days }, null).Tag = objNewCreditLimit; System.Int32 iRemoveIndx = -1; for (System.Int32 i = 0; i < listBoxCompany.Items.Count; i++) { if (((CCompany)listBoxCompany.GetItemValue(i)).ID.CompareTo(objCompany.ID) == 0) { iRemoveIndx = i; break; } } if (iRemoveIndx >= 0) { listBoxCompany.Items.RemoveAt(iRemoveIndx); } SetPropertiesModified(true); } } catch (System.Exception f) { SendMessageToLog("Ошибка редактирования кредитного лимита клиента. Текст ошибки: " + f.Message); } finally { EnableCompanyBtns(); } return; }
public bool CCommpanyInfoAddScreen() { Console.WriteLine("Lütfen Bilgilerinizi Giriniz."); Console.Write("Ad : "); string name = Console.ReadLine(); Console.Write("Soyad : "); string surname = Console.ReadLine(); Console.Write("Eğitim Durumu : "); string educationStatus = Console.ReadLine(); Console.Write("Email: "); string email = Console.ReadLine(); if (!string.IsNullOrEmpty(email)) { var generateRandomCode = _otpService.GenerateCode(); Console.WriteLine(string.Format("Lütfen Size İletilen Kodu Giriniz Kodunuz : {0}", generateRandomCode)); string otpCode = Console.ReadLine(); if (otpCode != generateRandomCode) { Console.Write("Doğrulama Başarısız.Lütfen Tekrar Deneyiniz."); return(false); } else { Console.WriteLine("Doğrulama Başarılı"); CCompany cCompany = new CCompany() { Name = name, Surname = surname, EducationStatus = educationStatus, Email = email, IsVerification = true }; Add(cCompany); Console.WriteLine(string.Format("Ad : {0} - Soyad : {1} - Eğitim Durumu : {2} - GSM : {3}", name, surname, educationStatus, email)); return(true); } } else { Console.Write("Lütfen EMAIL Bilginizi Giriniz."); return(false); } }
void LoadReport() { cbReport.Items.Clear(); CCompany Company = (CCompany)Program.Ctx.CompanyMgr.Find(Program.User.B_Company_id); List <CBaseObject> lstObj = Company.ReportMgr.GetList(); foreach (CBaseObject obj in lstObj) { CReport Report = (CReport)obj; DataItem item = new DataItem(Report.Name, Report); cbReport.Items.Add(item); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["User"] == null) { //Response.Redirect("../Login.aspx"); //Response.End(); return; } m_DesktopGroupMgr = Global.GetCtx(Session["TopCompany"].ToString()).DesktopGroupMgr; string GroupId = Request["GroupId"]; if (!string.IsNullOrEmpty(GroupId)) { m_guidCurGroupId = new Guid(GroupId); m_CurGroup = (CDesktopGroup)m_DesktopGroupMgr.Find(m_guidCurGroupId); } if (Request.Params["Action"] == "DelDesktopApp") { DelDesktopApp(); Response.End(); } else if (Request.Params["Action"] == "SetBackImg") { SetBackImg(); Response.End(); } else if (Request.Params["Action"] == "UpdateOnlineState") { UpdateOnlineState(); Response.End(); } //桌面背景 m_sBackImg = string.Format("../{0}/DesktopImg/default.jpg", Global.GetDesktopIconPathName()); CUser user = (CUser)Session["User"]; m_Company = (CCompany)Global.GetCtx(Session["TopCompany"].ToString()).CompanyMgr.Find(user.B_Company_id); CDesktop desktop = (CDesktop)user.DesktopMgr.GetFirstObj(); if (desktop != null && desktop.BackImg != "") { m_sBackImg = string.Format("../{0}/DesktopImg/{1}", Global.GetDesktopIconPathName(), desktop.BackImg); } m_UserMenuMgr = user.UserMenuMgr; m_DesktopAppMgr = user.DesktopAppMgr; }
protected void Page_Load(object sender, EventArgs e) { if (Session["User"] == null) { Response.Redirect("../Login.aspx"); Response.End(); } string B_Company_id = Request["B_Company_id"]; if (string.IsNullOrEmpty(B_Company_id)) { m_Company = Global.GetCtx(Session["TopCompany"].ToString()).CompanyMgr.FindTopCompany(); } else { m_Company = (CCompany)Global.GetCtx(Session["TopCompany"].ToString()).CompanyMgr.Find(new Guid(B_Company_id)); } string wfid = Request["wfid"]; if (string.IsNullOrEmpty(wfid)) { Response.End(); return; } m_WorkflowDef = (CWorkflowDef)m_Company.WorkflowDefMgr.Find(new Guid(wfid)); if (m_WorkflowDef == null) //可能是新建的 { if (Session["AddWorkflowDef"] == null) { Response.End(); return; } m_WorkflowDef = (CWorkflowDef)Session["AddWorkflowDef"]; } m_ActivesDefMgr = (CActivesDefMgr)m_WorkflowDef.ActivesDefMgr; m_Table = m_ActivesDefMgr.Table; if (Request.Params["Action"] == "Cancel") { m_ActivesDefMgr.Cancel(); Response.End(); } else if (Request.Params["Action"] == "PostData") { PostData(); Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["User"] == null) { Response.Redirect("../Login.aspx"); Response.End(); } string B_Company_id = Request["B_Company_id"]; if (string.IsNullOrEmpty(B_Company_id)) { m_Company = Global.GetCtx(Session["TopCompany"].ToString()).CompanyMgr.FindTopCompany(); } else { m_Company = (CCompany)Global.GetCtx(Session["TopCompany"].ToString()).CompanyMgr.Find(new Guid(B_Company_id)); } m_Table = m_Company.WorkflowCatalogMgr.Table; string id = Request["id"]; if (string.IsNullOrEmpty(id)) { Response.Write("请选择记录!"); Response.End(); } m_BaseObject = m_Company.WorkflowCatalogMgr.Find(new Guid(id)); if (m_BaseObject == null) { Response.Write("请选择记录!"); Response.End(); } //保存到编辑对象 EditObject.Add(Session.SessionID, m_BaseObject); if (Request.Params["Action"] == "Cancel") { m_BaseObject.Cancel(); Response.End(); } else if (Request.Params["Action"] == "PostData") { PostData(); //从编辑对象移除 EditObject.Remove(Session.SessionID, m_BaseObject); Response.End(); } }
public static List <CSData> GetGroupData() { List <CSData> datas = new List <CSData>(); int cc = 10; List <CCompany> Companys = new List <CCompany>(); for (int i = 0; i < cc; i++) { CCompany cmp = new CCompany() { CompanyID = "CID" + (i + 1), CompanyName = "CNAME" + (i + 1) }; Companys.Add(cmp); } int dd = 100; List <CDepartment> dps = new List <CDepartment>(); for (int i = 0; i < dd; i++) { CDepartment dp = new CDepartment() { CompanyID = Companys.ElementAt(i % cc).CompanyID, DepartmentID = "DPID" + (i + 1), DepartmentName = "DPNAME" + (i + 1) }; dps.Add(dp); } int pp = 1500; List <CPersion> ps = new List <CPersion>(); for (int i = 0; i < pp; i++) { CPersion p = new CPersion() { CompanyID = dps.ElementAt(i % dd).CompanyID, DepartmentID = dps.ElementAt(i % dd).DepartmentID, PersionName = "PName" + (i + 1) }; ps.Add(p); } int j = 0; foreach (var p in ps) { CSData d1 = new CSData() { CompanyID = p.CompanyID, DepartmentID = p.DepartmentID, PersionID = p.PersionID, Say = "hello" + (j + 1) }; datas.Add(d1); j++; } return(datas); }
public LoanCompany CopyCCompanyToLoanCompany(CCompany cCompany, LoanCompany loanCompany) { loanCompany.ContactType = cCompany.ContactType; loanCompany.CompanyName = cCompany.CompanyName; loanCompany.StreetAddress = cCompany.StreetAddress; loanCompany.Zip = cCompany.Zip; loanCompany.City = cCompany.City; loanCompany.StateId = cCompany.StateId; loanCompany.CompanyPhoneNumber = cCompany.CompanyPhoneNumber; loanCompany.LicenseNumber = cCompany.LicenseNumber; loanCompany.Deactivated = cCompany.Deactivated; loanCompany.WebURL = cCompany.WebURL; return(loanCompany); }
protected override void Recuperar_Registro() { CCompanyFactory faCompany = new CCompanyFactory(); CCompany oCompany = faCompany.GetByPrimaryKey(new CCompanyKeys(IDCompany)); if (oCompany != null) { tbBusinessName.Text = oCompany.Business_name; tbClientRuc.Text = oCompany.Ruc; tbClientDomicile.Text = oCompany.Domicile; tbClientEmail.Text = oCompany.Mail; tbClientPhone.Text = oCompany.Phone_client; cbTypeCompany.EditValue = Convert.ToChar(oCompany.Type_company); } }
protected override bool Grabar_Registro() { CCompanyFactory faCompany = new CCompanyFactory(); CCompany oCompany; if ((oCompany = faCompany.GetByPrimaryKey(new CCompanyKeys(IDCompany))) == null) { oCompany = new CCompany(); } oCompany.Idcompany = IDCompany; oCompany.Business_name = tbBusinessName.Text; oCompany.Domicile = tbClientDomicile.Text; oCompany.Mail = tbClientEmail.Text; oCompany.Phone_client = tbClientPhone.Text; oCompany.Ruc = tbClientRuc.Text; oCompany.Type_company = Convert.ToChar(cbTypeCompany.EditValue); if (IDCompany == 0) { oCompany.Usernew = Comun.GetUser(); oCompany.Useredit = Comun.GetUser(); oCompany.Datenew = Comun.GetDate(); oCompany.Dateedit = Comun.GetDate(); } else { oCompany.Useredit = Comun.GetUser(); oCompany.Dateedit = Comun.GetDate(); } bool result = false; if (!(result = faCompany.Update(oCompany))) { if (!result) { result = faCompany.Insert(oCompany); } } if (result) { LoadDataMasterSearh(new CCompanyFactory().GetAllDataTable()); } return(result); }
//获取权限目录 void GetSecurityAccess() { string B_Company_id = Request["B_Company_id"]; if (string.IsNullOrEmpty(B_Company_id)) { return; } CCompany Company = (CCompany)Global.GetCtx(Session["TopCompany"].ToString()).CompanyMgr.Find(new Guid(B_Company_id)); if (Company == null) { return; } string sJson = "["; string sItem = string.Format("{{ isexpand: \"false\", name: \"nodeSecurityDesktopGroupAccess\",\"id\":\"\",\"text\": \"{0}\",\"url\": \"Security/Access/DesktopGroupAccessPanel.aspx?B_Company_id={1}\",\"B_Company_id\":\"{1}\" }},", "桌面组权限", B_Company_id); sJson += sItem; sItem = string.Format("{{ isexpand: \"false\", name: \"nodeSecurityViewAccess\",\"id\":\"\",\"text\": \"{0}\",\"url\": \"Security/Access/ViewAccessPanel.aspx?B_Company_id={1}\",\"B_Company_id\":\"{1}\" }},", "视图权限", B_Company_id); sJson += sItem; sItem = string.Format("{{ isexpand: \"false\", name: \"nodeSecurityTableAccess\",\"id\":\"\",\"text\": \"{0}\",\"url\": \"Security/Access/TableAccessPanel.aspx?B_Company_id={1}\",\"B_Company_id\":\"{1}\" }},", "表权限", B_Company_id); sJson += sItem; sItem = string.Format("{{ isexpand: \"false\", name: \"nodeSecurityColumnAccess\",\"id\":\"\",\"text\": \"{0}\",\"url\": \"Security/Access/ColumnAccessPanel.aspx?B_Company_id={1}\",\"B_Company_id\":\"{1}\" }},", "字段权限", B_Company_id); sJson += sItem; sItem = string.Format("{{ isexpand: \"false\", name: \"nodeSecurityMenuAccess\",\"id\":\"\",\"text\": \"{0}\",\"url\": \"Security/Access/MenuAccessPanel.aspx?B_Company_id={1}\",\"B_Company_id\":\"{1}\" }},", "菜单权限", B_Company_id); sJson += sItem; sItem = string.Format("{{ isexpand: \"false\", name: \"nodeSecurityReportAccess\",\"id\":\"\",\"text\": \"{0}\",\"url\": \"Security/Access/ReportAccessPanel.aspx?B_Company_id={1}\",\"B_Company_id\":\"{1}\" }},", "报表权限", B_Company_id); sJson += sItem; sJson = sJson.TrimEnd(",".ToCharArray()); sJson += "]"; Response.Write(sJson); }
public CCreditLimitArjive(System.DateTime dtDateUpdate, System.String strActionTypeName, System.String strUserName, System.Guid uuidID, CCustomer objCustomer, CCompany objCompany, CCurrency objCurrency, double mApprovedCurrencyValue, double mCurrencyValue, int iApprovedDays, int iDays) { m_objDateUpdate = dtDateUpdate; m_strActionTypeName = strActionTypeName; m_strUserName = strUserName; ID = uuidID; Customer = objCustomer; Company = objCompany; Currency = objCurrency; ApprovedCurrencyValue = mApprovedCurrencyValue; CurrencyValue = mCurrencyValue; ApprovedDays = iApprovedDays; Days = iDays; }
public CResult Delete(CCompany oCompany) { oResult = new CResult(); conn = oConnManager.GetConnection(out s_DBError); if (conn != null) { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.Parameters.Clear(); cmd.Transaction = oConnManager.BeginTransaction(); try { cmd.CommandText = "sp_Company_Delete"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Comp_OId", oCompany.Comp_OId); cmd.Parameters.Add("@IsSuccess", SqlDbType.Char, 1); cmd.Parameters["@IsSuccess"].Direction = ParameterDirection.ReturnValue; cmd.ExecuteNonQuery(); string st = cmd.Parameters["@IsSuccess"].Value.ToString(); oConnManager.Commit(); oResult.Data = st; oResult.IsSuccess = true; } catch (SqlException e) { string sRollbackError = oConnManager.Rollback(); oResult.IsSuccess = false; oResult.ErrMsg = sRollbackError.Equals("") ? oConnManager.GetErrorMessage(e) : sRollbackError; } finally { oConnManager.Close(); } } else { oResult.IsSuccess = false; oResult.ErrMsg = s_DBError; } return(oResult); }
protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetNoStore(); if (Session["User"] == null) { Response.Redirect("../Login.aspx"); Response.End(); } CUser user = (CUser)Session["User"]; m_Company = (CCompany)Global.GetCtx(Session["TopCompany"].ToString()).CompanyMgr.Find(user.B_Company_id); if (Request.Params["Action"] == "GetData") { GetData(); Response.End(); } }
public ActionResult View(int id) { try { // USED IN POST METHOD ViewBag.Header = "View"; ViewBag.IsSuccess = 0; ViewBag.Message = ""; fnSetProperties(); CCompany company = CFCompany.CompanyDetailGetById(id); CompanyModel objCompanyModel = new CompanyModel(company); return(View("Edit", objCompanyModel)); } catch (Exception ex) { return(RedirectToAction("Index", "Error", new { Message = ex.Message, InnerException = ex.InnerException })); } }
//获取安全性的单位目录 void GetSecurityCompany() { string sJson = "["; List <CBaseObject> lstObj = Global.GetCtx(Session["TopCompany"].ToString()).CompanyMgr.GetList(); foreach (CBaseObject obj in lstObj) { CCompany Company = (CCompany)obj; string sItem = string.Format("{{ isexpand: \"false\", name: \"nodeSecurityCompany\",\"id\":\"{0}\",\"text\": \"{1}\", children: [] }},", Company.Id, Company.Name); sJson += sItem; } sJson = sJson.TrimEnd(",".ToCharArray()); sJson += "]"; Response.Write(sJson); }
/// <summary> /// Построение столбцов и строк в дереве /// </summary> private void InitializeTreeList() { try { List <CCustomerCategory> objCustomerCategoryList = CCustomerCategory.GetCustomerCategoryList(m_objProfile, null); if (objCustomerCategoryList != null) { DevExpress.XtraTreeList.Columns.TreeListColumn colCustomerCategory = null; foreach (CCustomerCategory objCustomerCategory in objCustomerCategoryList) { colCustomerCategory = this.treeList.Columns.Add(); colCustomerCategory.ColumnEdit = repItemCheckEdit; colCustomerCategory.Caption = objCustomerCategory.Code; colCustomerCategory.FieldName = objCustomerCategory.Code; colCustomerCategory.MinWidth = 50; colCustomerCategory.Name = objCustomerCategory.ID.ToString(); colCustomerCategory.OptionsColumn.AllowSort = false; colCustomerCategory.Visible = true; colCustomerCategory.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; colCustomerCategory.Tag = objCustomerCategory; } } objCustomerCategoryList = null; List <CCompany> objCompanyList = CCompany.GetCompanyList(m_objProfile, null); if (objCompanyList != null) { foreach (CCompany objCompany in objCompanyList) { treeList.AppendNode(new object[] { objCompany.Abbr }, null).Tag = objCompany; } } objCompanyList = null; } catch (System.Exception f) { SendMessageToLog("Ошибка установки начальных настроек дерева. Текст ошибки: " + f.Message); } finally { } return; }
public CDataResult <int> AddCompany(CompanyInput input) { var newCompany = new CCompany() { CompanyName = input.CompanyName, CompanyAddress = input.CompanyAddress, Contactor = input.Contactor, Mobile = input.Mobile }; var newNoticeId = this._companyRepository.InsertAndGetId(newCompany); return(new CDataResult <int>() { IsSuccess = true, ErrorMessage = null, Data = newNoticeId }); }
protected override bool Grabar_Registro() { CCompanyFactory faCompany = new CCompanyFactory(); CCompany oCompany; if ((oCompany = faCompany.GetByPrimaryKey(new CCompanyKeys(IDCompany))) == null) oCompany = new CCompany(); oCompany.Idcompany = IDCompany; oCompany.Business_name = tbBusinessName.Text; oCompany.Domicile = tbClientDomicile.Text; oCompany.Mail = tbClientEmail.Text; oCompany.Phone_client = tbClientPhone.Text; oCompany.Ruc = tbClientRuc.Text; oCompany.Type_company = Convert.ToChar(cbTypeCompany.EditValue); if (IDCompany == 0) { oCompany.Usernew = Comun.GetUser(); oCompany.Useredit = Comun.GetUser(); oCompany.Datenew = Comun.GetDate(); oCompany.Dateedit = Comun.GetDate(); } else { oCompany.Useredit = Comun.GetUser(); oCompany.Dateedit = Comun.GetDate(); } bool result = false; if (!(result = faCompany.Update(oCompany))) { if (!result) { result = faCompany.Insert(oCompany); } } if (result) LoadDataMasterSearh(new CCompanyFactory().GetAllDataTable()); return result; }
void GetData() { string B_Company_id = Request["B_Company_id"]; string FW_Table_id = Request["FW_Table_id"]; if (string.IsNullOrEmpty(B_Company_id) || string.IsNullOrEmpty(FW_Table_id)) { return; } CCompany Company = (CCompany)Global.GetCtx(Session["TopCompany"].ToString()).CompanyMgr.Find(new Guid(B_Company_id)); if (Company == null) { return; } string sData = ""; List <CBaseObject> lstObj = Company.WorkflowDefMgr.GetList(); int iCount = 0; foreach (CBaseObject obj in lstObj) { CWorkflowDef WorkflowDef = (CWorkflowDef)obj; if (WorkflowDef.FW_Table_id != new Guid(FW_Table_id)) { continue; } sData += string.Format("{{ \"id\": \"{0}\",\"Name\":\"{1}\"}}," , WorkflowDef.Id, WorkflowDef.Name); iCount++; } sData = sData.TrimEnd(",".ToCharArray()); sData = "[" + sData + "]"; string sJson = string.Format("{{\"Rows\":{0},\"Total\":\"{1}\"}}" , sData, iCount); Response.Write(sJson); }
/// <summary> /// Select by primary key /// </summary> /// <param name="keys">primary keys</param> /// <returns>CCompany business object</returns> public CCompany SelectByPrimaryKey(CCompanyKeys keys) { NpgsqlCommand sqlCommand = new NpgsqlCommand(); sqlCommand.CommandText = "public.sp_company_SelectByPrimaryKey"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.Add(new NpgsqlParameter("p_idcompany", NpgsqlDbType.Smallint, 2, "", ParameterDirection.Input, false, 0, 0, DataRowVersion.Proposed, keys.Idcompany)); MainConnection.Open(); NpgsqlDataReader dataReader = sqlCommand.ExecuteReader(); if (dataReader.Read()) { CCompany businessObject = new CCompany(); PopulateBusinessObjectFromReader(businessObject, dataReader); return(businessObject); } else { return(null); } } catch (Exception ex) { throw new Exception("CCompany::SelectByPrimaryKey::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
private void btnUpdate_Click(object sender, EventArgs e) { CCompany oCompany = GetFormData(); CCompanyBO oCompanyBO = new CCompanyBO(); CResult oResult = new CResult(); if (DialogResult.OK == MessageBox.Show("Are you want to delete " + txtCode.Text + " ?", "Confirmation!", MessageBoxButtons.OKCancel)) { oResult = oCompanyBO.Update(oCompany); } if (oResult.IsSuccess) { MessageBox.Show("Updated successfully"); } else { MessageBox.Show(oResult.ErrMsg); } LoadAllCompany(); }
public CCompany CompanyDetailGetById(int CompanyId) { try { CCompany oResult = new CCompany(); // SELECT THE INFORMATION FROM THE STORE-PROCEDURE AND SET INFORMATION TO THE DATASET DataSet dsCompanyInfo = _sqlService.GetDataSet("TCompanyInfo", "uspCompanyInfoGet " + CompanyId); using (DataTable dtCompanyInfo = dsCompanyInfo.Tables["TCompanyInfo"]) { if (dtCompanyInfo.Rows.Count > 0 && CompanyId > 0) { oResult.CompanyID = Convert.ToInt64(dtCompanyInfo.Rows[0]["CompanyID"].ToString()); oResult.Name = dtCompanyInfo.Rows[0]["Name"].ToString(); oResult.Address = dtCompanyInfo.Rows[0]["Address"].ToString(); oResult.Email = dtCompanyInfo.Rows[0]["Email"].ToString(); oResult.Mobile = dtCompanyInfo.Rows[0]["Mobile"].ToString(); oResult.LogoImgPath = _sqlService.ImagePathGet(dtCompanyInfo.Rows[0]["LogoImage"].ToString(), 0, string.Empty); oResult.MasterUsername = dtCompanyInfo.Rows[0]["Username"].ToString(); oResult.MasterPassword = "******"; oResult.Status = dtCompanyInfo.Rows[0]["Status"].ToString(); oResult.LastLogged = Convert.ToDateTime(dtCompanyInfo.Rows[0]["LastLogged"].ToString()); oResult.LoginBeforeLastLogged = Convert.ToDateTime(dtCompanyInfo.Rows[0]["LoginBeforeLastLogged"].ToString()); oResult.Success = true; oResult.WasSuccessful = 1; } else { oResult.Success = false; oResult.WasSuccessful = 0; oResult.Exception = "No Record Found!"; } return(oResult); } } catch (Exception ex) { throw ex; } }
public object GetVarValue(string sKey) { if (sKey.Equals("[当前用户ID]", StringComparison.OrdinalIgnoreCase)) { return(Program.User.Id); } else if (sKey.Equals("[当前用户名]", StringComparison.OrdinalIgnoreCase)) { return(Program.User.Name); } else if (sKey.Equals("[当前单位ID]", StringComparison.OrdinalIgnoreCase)) { return(Program.User.B_Company_id); } else if (sKey.Equals("[当前单位名]", StringComparison.OrdinalIgnoreCase)) { CCompany Company = (CCompany)Program.Ctx.CompanyMgr.Find(Program.User.B_Company_id); if (Company != null) { return(Company.Name); } } else if (sKey.Equals("[顶级单位ID]", StringComparison.OrdinalIgnoreCase)) { CCompany Company = (CCompany)Program.Ctx.CompanyMgr.FindTopCompany(); if (Company != null) { return(Company.Id); } } else if (sKey.Equals("[顶级单位名]", StringComparison.OrdinalIgnoreCase)) { CCompany Company = (CCompany)Program.Ctx.CompanyMgr.FindTopCompany(); if (Company != null) { return(Company.Name); } } return(null); }
protected void Page_Load(object sender, EventArgs e) { string B_Company_id = Request["B_Company_id"]; if (string.IsNullOrEmpty(B_Company_id)) { m_Company = Global.GetCtx(Session["TopCompany"].ToString()).CompanyMgr.FindTopCompany(); } else { m_Company = (CCompany)Global.GetCtx(Session["TopCompany"].ToString()).CompanyMgr.Find(new Guid(B_Company_id)); } m_Table = (CTable)m_Company.OrgMgr.Table; string id = Request["id"]; if (string.IsNullOrEmpty(id)) { Response.Write("请选择记录!"); Response.End(); } m_BaseObject = (COrg)m_Company.OrgMgr.Find(new Guid(id)); if (m_BaseObject == null) { Response.Write("请选择记录!"); Response.End(); } if (Request.Params["Action"] == "Cancel") { m_BaseObject.Cancel(); Response.End(); } else if (Request.Params["Action"] == "PostData") { PostData(); Response.End(); } }
//获取报表目录 void GetReportCatalog() { string B_Company_id = Request["B_Company_id"]; if (string.IsNullOrEmpty(B_Company_id)) { return; } CCompany Company = (CCompany)Global.GetCtx(Session["TopCompany"].ToString()).CompanyMgr.Find(new Guid(B_Company_id)); if (Company == null) { return; } string pid = Request["pid"]; Guid Parent_id = Guid.Empty; if (!string.IsNullOrEmpty(pid)) { Parent_id = new Guid(pid); } //context.Response.Write(@"[{text: 'Report'}]"); string sJson = "["; List <CBaseObject> lstReportCatalog = Company.ReportCatalogMgr.GetList(); foreach (CBaseObject obj in lstReportCatalog) { CReportCatalog catalog = (CReportCatalog)obj; if (catalog.Parent_id == Parent_id) { string sItem = string.Format("{{ isexpand: \"false\", name: \"nodeReportCatalog\",\"id\":\"{0}\",\"text\": \"{1}\",\"url\": \"Report/ReportPanel.aspx?catalog_id={0}&B_Company_id={2}\",\"B_Company_id\":\"{2}\", children: [] }},", catalog.Id, catalog.Name, B_Company_id); sJson += sItem; } } sJson = sJson.TrimEnd(",".ToCharArray()); sJson += "]"; Response.Write(sJson); }
void LoadReportRoot(TreeNode pnode) { List <CBaseObject> lstObj = Program.Ctx.CompanyMgr.GetList(); foreach (CBaseObject obj in lstObj) { CCompany Company = (CCompany)obj; TreeNode node = new TreeNode(); node.Name = "nodeReportCompany"; node.Text = Company.Name; TreeNodeTag tag = new TreeNodeTag(); tag.NodeType = TreeNodeType.ReportCompany; tag.Data = Company; node.ImageIndex = 12; node.SelectedImageIndex = 12; node.Tag = tag; pnode.Nodes.Add(node); LoadReportCatalog(Company, node); } }
void RetrieveDataCompany() { // --- recuperate the clients if (cbCompany.EditValue != null) { if (cbCompany.EditValue.ToString().Trim() != "" && cbCompany.EditValue.ToString().Trim() != "0") { CCompany oCompany = new CCompany(); CCompanyFactory faCompany = new CCompanyFactory(); oCompany = faCompany.GetByPrimaryKey(new CCompanyKeys(Convert.ToInt16(cbCompany.EditValue))); tbClientDomicile.Text = oCompany.Domicile; tbClientPhone.Text = oCompany.Phone_client; tbClientRuc.Text = oCompany.Ruc; // --- get/show contacts Reception oReception = new BusinessLayer.Modules.Reception(); gcContact.DataSource = new BindingList<CContact>(oReception.GetLstContactsByCompany(oCompany.Idcompany)); } // --- get/show attached files Show_exist_files(); } }
bool SaveRegisterReception() { bool result = false; object obj = deHourReception.EditValue; try { #region save head if (oRecep_sample == null) oRecep_sample = new CRecep_sample(); else { if (loadData == LoadData.FromRR_ToExtendRR) oRecep_sample.Idrecep_sample = 0; } CPersonFactory faPerson = new CPersonFactory(); Reception oReception = new BusinessLayer.Modules.Reception(); // --- save company bool result_company = false; CCompany oCompany = new CCompany(); if (cbCompany.EditValue != null) { CCorr_modulesFactory faCorr_modules = new CCorr_modulesFactory(); CCompanyFactory faCompany = new CCompanyFactory(); oCompany.Idcompany = Convert.ToInt16(cbCompany.EditValue); //oCompany.Cod_company = faCorr_modules.GetCorrModule(Comun.Formulario.fmEmpresa.ToString()); oCompany.Ruc = tbClientRuc.Text; oCompany.Business_name = cbCompany.Text; oCompany.Domicile = tbClientDomicile.Text; oCompany.Type_company = 'C'; // --- client oCompany.Phone_client = tbClientPhone.Text; if (!(result_company = faCompany.Update(oCompany))) result_company = faCompany.Insert(oCompany); } // --- save head if (!result_company) { ComunForm.Send_message(this.Text, TypeMsg.error, "Error al guardar cliente, no se pudo completar la operación."); return false; } bool result_recep_sample = false; oReception.GetNewCodReception(); oRecep_sample.Cod_recep_sample = oReception.GetFormatCodReception(); oRecep_sample.Idcompany = oCompany.Idcompany; oRecep_sample.Date_reception = deReception.DateTime; DateTime Hour_reception = Convert.ToDateTime(deHourReception.EditValue); oRecep_sample.Date_reception = new DateTime( deReception.DateTime.Year, deReception.DateTime.Month, deReception.DateTime.Day, Hour_reception.Hour, Hour_reception.Minute, Hour_reception.Second); DateTime Hour_result = Convert.ToDateTime(deHourResult.EditValue); oRecep_sample.Date_result = new DateTime( deResult.DateTime.Year, deResult.DateTime.Month, deResult.DateTime.Day, Hour_result.Hour, Hour_result.Minute, Hour_result.Second); oRecep_sample.Cod_type_sample = cbTypeSample.EditValue.ToString(); oRecep_sample.Total_amount = Convert.ToDecimal(tbSubTotalAmount.Text); oRecep_sample.Total_igv = Convert.ToDecimal(tbTotalIgv.Text); oRecep_sample.Total_amount_igv = Convert.ToDecimal(tbTotalAmount.Text); oRecep_sample.Amortization = Convert.ToDecimal(tbAmortization.Text); oRecep_sample.Flag_isprice = false; //oRecep_sample.Discount = ckDiscount.Checked == true ? tbDiscount.Value : 0; if (oRecep_sample.Idrecep_sample == 0) { oRecep_sample.Usernew = Comun.GetUser(); oRecep_sample.Datenew = Comun.GetDate(); } oRecep_sample.Useredit = Comun.GetUser(); oRecep_sample.Dateedit = Comun.GetDate(); if (!(result_recep_sample = faRecep_sample.Update(oRecep_sample))) result_recep_sample = faRecep_sample.Insert(oRecep_sample); if (!result_recep_sample) { ComunForm.Send_message(this.Text, TypeMsg.error, "Error al guardar datos en recepción, no se pudo completar la operación."); return false; } #endregion #region update price if (result_recep_sample && oPrice_version != null && oPrice_version.Idprice_version > 0) { oPrice_version.Status_price = 4; faPrice_version.Update(oPrice_version); } #endregion #region save detail // --- contacts and detail if (result_recep_sample) { // --- save contacts CPerson oContact = new CPerson(); CRecep_company_person oRecep_company_person = new CRecep_company_person(); CRecep_company_personFactory faRecep_company_person = new CRecep_company_personFactory(); // --- delete all tbCod_recep_sample.Text = oReception.GetFormatCodReception(); oReception.SetDisabledContact(oRecep_sample.Idrecep_sample); for (int i = 0; i < gvContact.RowCount; i++) { oContact.Idperson = Convert.ToInt16(gvContact.GetRowCellValue(i, gcCon_Idperson)); oContact.Phone = gvContact.GetRowCellValue(i, gcCon_Phone).ToString(); oContact.Cellphone = gvContact.GetRowCellValue(i, gcCon_Cellphone).ToString(); oContact.Mail = gvContact.GetRowCellValue(i, gcCon_Mail).ToString(); oContact.Allname = gvContact.GetRowCellValue(i, gcCon_Allname).ToString(); bool result_contact = false; if (!(result_contact = faPerson.Update(oContact))) result_contact = faPerson.Insert(oContact); if (result_contact) { oRecep_company_person = new CRecep_company_person(); oRecep_company_person.Idrecep_company_person = 0; oRecep_company_person.Idcompany = oCompany.Idcompany; oRecep_company_person.Idrecep_sample = oRecep_sample.Idrecep_sample; oRecep_company_person.Idperson = oContact.Idperson; oRecep_company_person.Person_type = Convert.ToInt16(gvContact.GetRowCellValue(i, gcCon_Person_type)); oRecep_company_person.Enabled_show = true; if (!faRecep_company_person.Update(oRecep_company_person)) faRecep_company_person.Insert(oRecep_company_person); } } // --- save dispatch CRecep_sample_dispatchFactory faRecep_sample_dispatch = new CRecep_sample_dispatchFactory(); CRecep_sample_dispatch oRecep_sample_dispatch = new CRecep_sample_dispatch(); oRecep_sample_dispatch.Idrecep_sample = oRecep_sample.Idrecep_sample; // --- person if (ckDispatchPerson.Checked) oRecep_sample_dispatch.Dispatch_person = 1; else oRecep_sample_dispatch.Dispatch_person = 0; // --- curier if (ckDispatchCurier.Checked) oRecep_sample_dispatch.Dispatch_curier = 1; else oRecep_sample_dispatch.Dispatch_curier = 0; // --- transport if (ckDispatchTransport.Checked) oRecep_sample_dispatch.Dispatch_transport = 1; else oRecep_sample_dispatch.Dispatch_transport = 0; // --- fax if (ckDispatchFax.Checked) oRecep_sample_dispatch.Dispatch_fax = 1; else oRecep_sample_dispatch.Dispatch_fax = 0; // --- save if (!faRecep_sample_dispatch.Update(oRecep_sample_dispatch)) faRecep_sample_dispatch.Insert(oRecep_sample_dispatch); // --------------------------------------------------------------------------- // --- save detail ----------------------------------------------------------- // --------------------------------------------------------------------------- CRecep_sample_detail oRecep_sample_detail = new CRecep_sample_detail(); CRecep_sample_detailFactory faRecep_sample_detail = new CRecep_sample_detailFactory(); CRecep_elem oRecep_elem = new CRecep_elem(); CRecep_elemFactory faRecep_elem = new CRecep_elemFactory(); CRecep_sample_detail_elem oRecep_sample_detail_elem = new CRecep_sample_detail_elem(); CRecep_sample_detail_elemFactory faRecep_sample_detail_elem = new CRecep_sample_detail_elemFactory(); CCorrelative oCorrelative = new CCorrelativeFactory().GetByPrimaryKey(new CCorrelativeKeys(oRecep_sample.Cod_type_sample)); if (oRecep_sample.Idrecep_sample > 0) { int i = 0; while (i < gvReception.RowCount) { oRecep_sample_detail = new CRecep_sample_detail(); oRecep_sample_detail.Idrecep_sample = oRecep_sample.Idrecep_sample; //if (gvReception.GetRowCellValue(i, gcRec_idrecep_sample_detail) != DBNull.Value) //oRecep_sample_detail.Idrecep_sample_detail = Convert.ToInt64(gvReception.GetRowCellValue(i, gcRec_idrecep_sample_detail)); oRecep_sample_detail.Idrecep_sample_detail = 0; oRecep_sample_detail.Order_sample = Convert.ToInt16(gvReception.GetRowCellValue(i, gcRec_OrderSample)); oRecep_sample_detail.Name_sample = gvReception.GetRowCellValue(i, gcRec_NameSample).ToString(); oRecep_sample_detail.Procedence = gvReception.GetRowCellValue(i, gcRec_Procedence).ToString(); oRecep_sample_detail.Cod_des_sample = gvReception.GetRowCellValue(i, gcRec_Description).ToString(); oRecep_sample_detail.Cod_type_sample = gvReception.GetRowCellValue(i, gcRec_Type_Sample).ToString(); oRecep_sample_detail.Cod_sample = gvReception.GetRowCellValue(i, gcRec_Code).ToString(); oRecep_sample_detail.Amount_weight = Convert.ToDecimal(gvReception.GetRowCellValue(i, gcRec_CantKg)); oRecep_sample_detail.Cost_sample = Convert.ToDecimal(gvReception.GetRowCellValue(i, gcRec_Cost)); oRecep_sample_detail.Flag_envelope_sealed = Convert.ToBoolean(gvReception.GetRowCellValue(i, gcRec_Flag_envelope_sealed)); oRecep_sample_detail.Flag_reject = Convert.ToBoolean(gvReception.GetRowCellValue(i, gcRec_Reject)); oRecep_sample_detail.Flag_counter_sample = Convert.ToInt16(gvReception.GetRowCellValue(i, gcRec_Counter_Sample)); oRecep_sample_detail.Analisys_time = Convert.ToInt16(gvReception.GetRowCellValue(i, gcRec_Days)); bool result_detail_elem = false; bool result_recep_sample_detail = false; if (!(result_recep_sample_detail = faRecep_sample_detail.Update(oRecep_sample_detail))) result_recep_sample_detail = faRecep_sample_detail.Insert(oRecep_sample_detail); if (result_recep_sample_detail) { if (FlagRegRecepCopy) { oRecep_sample_detail.Cod_interno = Convert.ToInt64(gvReception.GetRowCellValue(i, gcRec_Cod_interno)); oRecep_sample_detail.Cod_sample = gvReception.GetRowCellValue(i, gcRec_Code).ToString(); oRecep_sample_detail.Flag_control_sample = false; } else { // assign correlative code long Cod_interno = oReception.GetNewCodInternoSample(gvReception.GetRowCellValue(i, gcRec_Type_Sample).ToString()); string Format_cod_interno = oReception.GetFormatCodInternoSample(gvReception.GetRowCellValue(i, gcRec_Type_Sample).ToString()); oRecep_sample_detail.Cod_interno = Cod_interno; oRecep_sample_detail.Cod_sample = Format_cod_interno; oRecep_sample_detail.Flag_control_sample = false; } faRecep_sample_detail.Update(oRecep_sample_detail); #region save element cell repetition CRecep_sample_detail oRecep_sample_aux = faRecep_sample_detail.GetByPrimaryKey(new CRecep_sample_detailKeys(oRecep_sample_detail.Idrecep_sample_detail)); CSettings oSettings = new CSettings(); bool HasHumidityAnalysis = false; bool Has60GradesElement = false; // --- retrieve code sample and assign if (!Convert.ToBoolean(oRecep_sample_detail.Flag_control_sample)) gvReception.SetRowCellValue(i, gcRec_Code, oRecep_sample_aux.Cod_sample); // --- save element cell foreach (KeyValuePair<DevExpress.XtraGrid.Columns.GridColumn, bool> kvp in DicShowColumns) { if (kvp.Value) { bool value_check = Convert.ToBoolean(gvReception.GetRowCellValue(i, kvp.Key)); bool flag_control_sample = Convert.ToBoolean(oRecep_sample_detail.Flag_control_sample); if ((!flag_control_sample && value_check) || flag_control_sample) { oRecep_sample_detail_elem = new CRecep_sample_detail_elem(); CTagInfoMethod tagMethod = (CTagInfoMethod)kvp.Key.Tag; oRecep_sample_detail_elem.Idelement = tagMethod.IDElement; oRecep_sample_detail_elem.Idrecep_sample = oRecep_sample.Idrecep_sample; oRecep_sample_detail_elem.Idrecep_sample_detail = oRecep_sample_detail.Idrecep_sample_detail; oRecep_sample_detail_elem.Idtemplate_method = tagMethod.IDTemplate_method; oRecep_sample_detail_elem.Idcompany = oRecep_sample.Idcompany; oRecep_sample_detail_elem.Idunit = tagMethod.IDMeasurement_Unit; oRecep_sample_detail_elem.Cost_method = tagMethod.Cost_Method; if (!(result_detail_elem = faRecep_sample_detail_elem.Update(oRecep_sample_detail_elem))) result_detail_elem = faRecep_sample_detail_elem.Insert(oRecep_sample_detail_elem); if (result_detail_elem) { // crear bandejas CBatchManager oBatchManager = new CBatchManager(); oBatchManager.CallSaveSampleBatch( Convert.ToInt32(oRecep_sample_detail_elem.Idtemplate_method), Convert.ToInt64(oRecep_sample_detail_elem.Idrecep_sample), Convert.ToInt64(oRecep_sample_detail_elem.Idrecep_sample_detail), oRecep_sample_detail_elem.Idrecep_sample_detail_elem, Convert.ToInt64(oRecep_sample_detail.Cod_interno), oRecep_sample_detail.Cod_sample, Comun.GetUser(), oCorrelative); // enviar a preparación de muestras } //verificar si tiene análisis por humedad if (oSettings.GetIdHumidityAnalysis().Contains(tagMethod.IDElement.ToString())) HasHumidityAnalysis = true; //verificar si tiene que elementos para ser analizados a 60° if (oSettings.GetIDElements60Grades().Contains(tagMethod.IDElement.ToString())) Has60GradesElement = true; } } } #endregion #region save sample preparation CPrep_samples oPrep_samples = new CPrep_samples(); oPrep_samples.Idrecep_sample_detail = oRecep_sample_detail.Idrecep_sample_detail; oPrep_samples.Flag_counter_sample = oRecep_sample_detail.Flag_counter_sample; oPrep_samples.Flag_reject = oRecep_sample_detail.Flag_reject; oPrep_samples.Flag_humidity_analysis = HasHumidityAnalysis; oPrep_samples.Flag_60celsius = Has60GradesElement; oPrep_samples.Date_creation = Comun.GetDate(); oPrep_samples.Moisture_reject = false; oPrep_samples.Final_moisture = 0; oPrep_samples.Final_reject = 0; oPrep_samples.Final_sample_prepared = 0; oPrep_samples.Final_weight_gross = 0; oPrep_samples.Output_flag_sample = false; oPrep_samples.Output_flag_cs = false; oPrep_samples.Output_flag_re = false; CPrep_samplesFactory faPrep_samples = new CPrep_samplesFactory(); if (!faPrep_samples.Update(oPrep_samples)) faPrep_samples.Insert(oPrep_samples); #endregion } if (!Convert.ToBoolean(oRecep_sample_detail.Flag_control_sample)) i++; } } #region save tag infor method // --- save tag info method (mr or blk) foreach (KeyValuePair<DevExpress.XtraGrid.Columns.GridColumn, bool> kvp in DicShowColumns) { if (kvp.Value) { CTagInfoMethod tagMethod = (CTagInfoMethod)kvp.Key.Tag; oRecep_elem = new CRecep_elem(); oRecep_elem.Idelement = tagMethod.IDElement; oRecep_elem.Idrecep_sample = oRecep_sample.Idrecep_sample; oRecep_elem.Idtemplate_method = tagMethod.IDTemplate_method; oRecep_elem.Name_unit = tagMethod.Name_Measurement_Unit; oRecep_elem.Idunit = tagMethod.IDMeasurement_Unit; oRecep_elem.Percent_repetition = tagMethod.Percent_repetition; if (!faRecep_elem.Update(oRecep_elem)) faRecep_elem.Insert(oRecep_elem); } } #endregion } #endregion result = true; } catch (Exception ex) { Comun.Save_log(ex.Message); if (ex.InnerException != null) Comun.Save_log(ex.InnerException.ToString()); return false; } return result; }