/// <summary> /// Get Customer Material By Customer And Material Id /// </summary> /// <param name="customerId">Int32:customerId</param> /// <param name="materialTypeId">Int32:materialTypeId</param> /// <returns></returns> public CustomerMaterialMapDTO GetCustomerMaterialByCustomerAndMaterialId(int customerId, int materialTypeId) { CustomerMaterialMapDTO customerMaterialDetails = new CustomerMaterialMapDTO(); AutoMapper.Mapper.Map(ESalesUnityContainer.Container.Resolve<IGenericRepository<customermaterialmap>>() .GetSingle(item => item.Cust_Mat_MaterialId == materialTypeId && item.Cust_Mat_CustId == customerId), customerMaterialDetails); return customerMaterialDetails; }
private IList<CustomerMaterialMapDTO> InitializeMaterialTypeDetails() { IList<CustomerMaterialMapDTO> listCustomerMaterial = new List<CustomerMaterialMapDTO>(); foreach (GridViewRow row in grdCustomerMaterialMapping.Rows) { if (row.RowType == DataControlRowType.DataRow) { CheckBox chkMaterial = ((CheckBox)(row.Cells[0].Controls[1])); if (chkMaterial.Enabled == true && chkMaterial.Checked == true) { CustomerMaterialMapDTO customerMaterialMap = new CustomerMaterialMapDTO(); customerMaterialMap.Cust_Mat_MaterialId = Convert.ToInt32(grdCustomerMaterialMapping.DataKeys[row.RowIndex].Value); customerMaterialMap.Cust_Mat_AnnualRequirement = Convert.ToInt32(((DropDownList)(row.Cells[2].Controls[1])).SelectedItem.Text); customerMaterialMap.Cust_Mat_AllotedQuantityId = 1; customerMaterialMap.Cust_Mat_LiftingLimit = 10; customerMaterialMap.Cust_Mat_CreatedBy = GetCurrentUserId(); customerMaterialMap.Cust_Mat_CreatedDate = DateTime.Now; listCustomerMaterial.Add(customerMaterialMap); } } } //return the value return listCustomerMaterial; }
/// <summary> /// Delete Customer Materials /// </summary> /// <param name="customerMaterials"></param> public void DeleteCustomerMaterials(CustomerMaterialMapDTO customerMaterials) { customermaterialmap customerMaterialMapEntity = new customermaterialmap(); AutoMapper.Mapper.Map(customerMaterials, customerMaterialMapEntity); ESalesUnityContainer.Container.Resolve<IGenericRepository<customermaterialmap>>().Update(customerMaterialMapEntity); }