private void btnImport_Click(object sender, EventArgs e) { if (txtfile.Text != "") { lblmessage.Text = ""; string strExportList = "C:\\SCMExportFile\\ExportMaster.xml"; string myXMLfile = txtfile.Text; string strext = Path.GetExtension(myXMLfile); if (strext != ".xml") { IQCareWindowMsgBox.ShowWindow("BrowseFile", this); return; } if (myXMLfile.ToUpper() != "C:\\SCMEXPORT\\SCMMASTER.XML") { IQCareWindowMsgBox.ShowWindow("Browswrongfile", this); return; } DataSet dsExportList = new DataSet(); System.IO.FileStream fsReadXml1 = new System.IO.FileStream(strExportList, System.IO.FileMode.Open); dsExportList.ReadXml(fsReadXml1); fsReadXml1.Close(); DataSet ds = new DataSet(); System.IO.FileStream fsReadXml = new System.IO.FileStream (myXMLfile, System.IO.FileMode.Open); try { ds.ReadXml(fsReadXml); //if (ds.Tables[0].Rows[0]["AppVer"].ToString() != GblIQCare.AppVersion || ((DateTime)ds.Tables[0].Rows[0]["RelDate"]).ToString("dd-MMM-yyyy") != GblIQCare.ReleaseDate) //{ // IQCareWindowMsgBox.ShowWindow("ImportScmMasterCheckVersion", this); // return; //} IImportExport theExportManager = (IImportExport)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BImportExport, BusinessProcess.FormBuilder"); if (ds.Tables.Count == 21) { theExportManager.DBBackUpImportData(); foreach (DataRow r in dsExportList.Tables[0].Rows) { if (r["Name"].ToString() == "PharmacyMaster") { theExportManager.BulkInsert(ds.Tables[1], "Mst_Drug"); theExportManager.BulkInsert(ds.Tables[2], "Mst_Generic"); theExportManager.BulkInsert(ds.Tables[3], "Lnk_DrugGeneric"); theExportManager.BulkInsert(ds.Tables[4], "Mst_DrugType"); theExportManager.BulkInsert(ds.Tables[5], "Lnk_DrugTypeGeneric"); theExportManager.BulkInsert(ds.Tables[21], "mst_strength"); theExportManager.BulkInsert(ds.Tables[22], "lnk_DrugStrength"); } if (r["Name"].ToString() == "ItemConfiguration") { theExportManager.ImportSCM(ds.Tables[6], "ItemConfiguration"); } if (r["Name"].ToString() == "Manufacturerdetail") { theExportManager.BulkInsert(ds.Tables[7], "mst_manufacturer"); } if (r["Name"].ToString() == "Programitemlinking") { theExportManager.ImportSCM(ds.Tables[8], "Programitemlinking"); } if (r["Name"].ToString() == "Storeitemlinking") { theExportManager.ImportSCM(ds.Tables[9], "Storeitemlinking"); } if (r["Name"].ToString() == "Supplieritemlinking") { theExportManager.ImportSCM(ds.Tables[10], "Supplieritemlinking"); } if (r["Name"].ToString() == "Program") { theExportManager.BulkInsert(ds.Tables[11], "mst_program"); } if (r["Name"].ToString() == "Donor") { theExportManager.BulkInsert(ds.Tables[12], "mst_donor"); } if (r["Name"].ToString() == "Programdonorlinking") { theExportManager.BulkInsert(ds.Tables[13], "Lnk_DonorProgram"); } if (r["Name"].ToString() == "Costallocationcategory") { theExportManager.ImportSCM(ds.Tables[14], "Costallocationcategory"); } if (r["Name"].ToString() == "Storedetail") { theExportManager.BulkInsert(ds.Tables[15], "mst_store"); } if (r["Name"].ToString() == "Storesourcedestinationlinking") { theExportManager.BulkInsert(ds.Tables[16], "lnk_StoreSourceDestination"); } if (r["Name"].ToString() == "Supplier") { theExportManager.BulkInsert(ds.Tables[17], "mst_supplier"); } if (r["Name"].ToString() == "Adjustmentreason") { theExportManager.ImportSCM(ds.Tables[18], "Adjustmentreason"); } if (r["Name"].ToString() == "Returnreason") { theExportManager.ImportSCM(ds.Tables[19], "Returnreason"); } if (r["Name"].ToString() == "Labtestlocation") { theExportManager.ImportSCM(ds.Tables[20], "Labtestlocation"); } if (r["Name"].ToString() == "AddConstraint") { theExportManager.ImportSCM(ds.Tables[10], "AddConstraint"); } } IQCareWindowMsgBox.ShowWindow("ImportSuccess", this); } else { IQCareWindowMsgBox.ShowWindow("Browswrongfile", this); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { fsReadXml.Close(); } } else { IQCareWindowMsgBox.ShowWindow("BrowseFile", this); return; } }
private void ShowGrid(DataTable theDT) { try { dgwStockLevelDetails.Columns.Clear(); dgwStockLevelDetails.AutoGenerateColumns = false; dgwStockLevelDetails.DataSource = null; DataGridViewTextBoxColumn Itemcode = new DataGridViewTextBoxColumn(); Itemcode.HeaderText = "ItemId"; Itemcode.DataPropertyName = "ItemId"; Itemcode.Width = 30; Itemcode.ReadOnly = true; Itemcode.Visible = false; DataGridViewTextBoxColumn ItemName = new DataGridViewTextBoxColumn(); ItemName.HeaderText = "Item Name"; ItemName.DataPropertyName = "DrugName"; ItemName.Width = 305; ItemName.ReadOnly = true; DataGridViewTextBoxColumn DispensingUnit = new DataGridViewTextBoxColumn(); DispensingUnit.HeaderText = "Dispensing Unit"; DispensingUnit.DataPropertyName = "DispensingUnit"; DispensingUnit.Width = 80; DispensingUnit.ReadOnly = true; DataGridViewTextBoxColumn BatchId = new DataGridViewTextBoxColumn(); BatchId.HeaderText = "Batch Id"; BatchId.DataPropertyName = "BatchId"; BatchId.Width = 100; BatchId.ReadOnly = false; BatchId.Visible = false; DataGridViewTextBoxColumn BatchNo = new DataGridViewTextBoxColumn(); BatchNo.HeaderText = "Batch No."; BatchNo.DataPropertyName = "Batch"; BatchNo.Width = 100; BatchNo.ReadOnly = false; DataGridViewTextBoxColumn ExpiryDate = new DataGridViewTextBoxColumn(); ExpiryDate.HeaderText = "Expiry Date"; ExpiryDate.DataPropertyName = "ExpiryDate"; ExpiryDate.Width = 100; ExpiryDate.ReadOnly = true; ExpiryDate.Visible = true; DataGridViewTextBoxColumn CurrentQuantity = new DataGridViewTextBoxColumn(); CurrentQuantity.HeaderText = "Current Quantity"; CurrentQuantity.DataPropertyName = "AvailableQTY"; CurrentQuantity.Width = 80; CurrentQuantity.ReadOnly = true; DataGridViewTextBoxColumn AdjustedQuantity = new DataGridViewTextBoxColumn(); AdjustedQuantity.HeaderText = "Adjusted Quantity"; AdjustedQuantity.DataPropertyName = "AdjQty"; AdjustedQuantity.Width = 80; AdjustedQuantity.ReadOnly = false; DataGridViewComboBoxColumn AdjustedReason = new DataGridViewComboBoxColumn(); AdjustedReason.HeaderText = "Adjusted Reason"; AdjustedReason.DataPropertyName = "AdjustReasonId"; AdjustedReason.Width = 200; DataSet XMLDS = new DataSet(); XMLDS.ReadXml(GblIQCare.GetXMLPath() + "\\AllMasters.con"); DataRow theDRReasoon = XMLDS.Tables["Mst_Decode"].NewRow(); theDRReasoon["Id"] = 0; theDRReasoon["Name"] = "Select"; theDRReasoon["CodeId"] = 205; theDRReasoon["DeleteFlag"] = 0; XMLDS.Tables["Mst_Decode"].Rows.Add(theDRReasoon); DataView theDV = new DataView(XMLDS.Tables["Mst_Decode"]); theDV.RowFilter = "CodeID=205 and (DeleteFlag =0 or DeleteFlag is null)"; theDV.Sort = "Id ASC"; //AdjustedReason AdjustedReason.DataSource = theDV.ToTable(); AdjustedReason.DisplayMember = "Name"; AdjustedReason.ValueMember = "Id"; AdjustedReason.ReadOnly = false; dgwStockLevelDetails.Columns.Add(Itemcode); dgwStockLevelDetails.Columns.Add(ItemName); dgwStockLevelDetails.Columns.Add(DispensingUnit); dgwStockLevelDetails.Columns.Add(BatchNo); dgwStockLevelDetails.Columns.Add(BatchId); dgwStockLevelDetails.Columns.Add(ExpiryDate); dgwStockLevelDetails.Columns.Add(CurrentQuantity); dgwStockLevelDetails.Columns.Add(AdjustedQuantity); dgwStockLevelDetails.Columns.Add(AdjustedReason); dgwStockLevelDetails.DataSource = theDT; } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this); } }
private void ShowGrid(DataTable theDT) { try{ dgwOpeningStock.Columns.Clear(); dgwOpeningStock.DataSource = null; DataGridViewTextBoxColumn ItemId = new DataGridViewTextBoxColumn(); ItemId.HeaderText = "Item Id"; ItemId.DataPropertyName = "ItemId"; ItemId.Width = 10; ItemId.ReadOnly = true; ItemId.Visible = false; DataGridViewTextBoxColumn ItemName = new DataGridViewTextBoxColumn(); ItemName.HeaderText = "Item Name"; ItemName.DataPropertyName = "ItemName"; ItemName.Width = 420; ItemName.ReadOnly = true; ItemName.Visible = true; DataGridViewTextBoxColumn StoreId = new DataGridViewTextBoxColumn(); StoreId.HeaderText = "Store"; StoreId.DataPropertyName = "StoreId"; StoreId.Width = 15; StoreId.ReadOnly = true; StoreId.Visible = false; DataGridViewTextBoxColumn StoreName = new DataGridViewTextBoxColumn(); StoreName.HeaderText = "Store"; StoreName.DataPropertyName = "StoreName"; StoreName.Width = 130; StoreName.ReadOnly = true; StoreName.Visible = true; DataGridViewTextBoxColumn DispensingUnit = new DataGridViewTextBoxColumn(); DispensingUnit.HeaderText = "Dispensing Unit"; DispensingUnit.DataPropertyName = "DispensingUnit"; DispensingUnit.Width = 50; DispensingUnit.ReadOnly = true; DispensingUnit.Visible = false; DataGridViewTextBoxColumn BatchId = new DataGridViewTextBoxColumn(); BatchId.HeaderText = "BatchNo"; BatchId.DataPropertyName = "BatchId"; BatchId.Width = 15; BatchId.ReadOnly = true; BatchId.Visible = false; DataGridViewTextBoxColumn BatchName = new DataGridViewTextBoxColumn(); BatchName.HeaderText = "Batch No."; BatchName.DataPropertyName = "BatchNo"; BatchName.Width = 135; BatchName.ReadOnly = true; BatchName.Visible = true; DataGridViewTextBoxColumn ExpiryDate = new DataGridViewTextBoxColumn(); ExpiryDate.HeaderText = "Expiry Date"; ExpiryDate.DataPropertyName = "ExpiryDate"; ExpiryDate.Width = 130; ExpiryDate.ReadOnly = true; ExpiryDate.Visible = true; DataGridViewTextBoxColumn Quantity = new DataGridViewTextBoxColumn(); Quantity.HeaderText = "Quantity"; Quantity.DataPropertyName = "Quantity"; Quantity.Width = 130; Quantity.ReadOnly = true; Quantity.Visible = true; DataGridViewTextBoxColumn OpeningStock = new DataGridViewTextBoxColumn(); OpeningStock.HeaderText = "OpeningStock"; OpeningStock.DataPropertyName = "OpeningStock"; OpeningStock.Width = 10; OpeningStock.ReadOnly = true; OpeningStock.Visible = false; //DataGridViewTextBoxColumn TransDate = new DataGridViewTextBoxColumn(); //TransDate.HeaderText = "TransDate"; //TransDate.DataPropertyName = "TransDate"; //TransDate.Width = 10; //TransDate.ReadOnly = true; //TransDate.Visible = false; dgwOpeningStock.Columns.Add(ItemId); dgwOpeningStock.Columns.Add(ItemName); dgwOpeningStock.Columns.Add(StoreId); dgwOpeningStock.Columns.Add(StoreName); dgwOpeningStock.Columns.Add(DispensingUnit); dgwOpeningStock.Columns.Add(BatchId); dgwOpeningStock.Columns.Add(BatchName); dgwOpeningStock.Columns.Add(ExpiryDate); dgwOpeningStock.Columns.Add(Quantity); dgwOpeningStock.Columns.Add(OpeningStock); //dgwOpeningStock.Columns.Add(TransDate); dgwOpeningStock.AutoGenerateColumns = false; dgwOpeningStock.DataSource = theDT; } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this); } }
/// <summary> /// This function is used to delete the selected form if no data is available for that form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDelete_Click(object sender, EventArgs e) { try { if (strFormNameDb == null) { IQCareWindowMsgBox.ShowWindow("PMTCTSelectAtleastOne", this); return; } else { for (int i = 0; i < objDsFormDetails.Tables[0].Rows.Count; i++) { if (strFormNameDb == objDsFormDetails.Tables[0].Rows[i]["FormName"].ToString()) { if (objDsFormDetails.Tables[0].Rows[i]["Published"].ToString() == "2") { IQCareWindowMsgBox.ShowWindow("PMTCTPublishedForm", this); return; } else { IManageForms objFormDetail; objFormDetail = (IManageForms)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BManageForms,BusinessProcess.FormBuilder"); objDsFormDetails = objFormDetail.CheckFormDetail(strFormName, GblIQCare.iFormBuilderId); if (objDsFormDetails.Tables[0].Rows.Count > 0) { if (objDsFormDetails.Tables[1].Rows[0]["Form_Exist"].ToString() == "0" || objDsFormDetails.Tables[1].Rows[0]["Form_Exist"].ToString() == null || objDsFormDetails.Tables[1].Rows[0]["Form_Exist"].ToString() == "") { DialogResult strResult; //strResult = MessageBox.Show("Do you want to delete this record", "Yes/No", MessageBoxButtons.YesNo); strResult = IQCareWindowMsgBox.ShowWindowConfirm("PMTCTConfirmDelete", this); if (strResult.ToString() == "Yes") { objFormDetail.DeleteFormTableDetail(strFormName, GblIQCare.iFormBuilderId); dgwFormDetails.DataSource = null; BindGrid(); MessageBox.Show("Form " + strFormNameDb + " deleted sucessfully", "Confirm", MessageBoxButtons.OK); strFormNameDb = null; } else { dgwFormDetails.DataSource = null; BindGrid(); return; } } else { IQCareWindowMsgBox.ShowWindow("PMTCTNotDeleted", this); dgwFormDetails.DataSource = null; BindGrid(); return; } } } } } } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this); } }
private void dgwFormDetails_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { try { Color ClrRed = Color.FromArgb(204, 0, 0); Color ClrPink = Color.FromArgb(255, 204, 204); if (e.ColumnIndex != -1 && e.RowIndex != -1) { if (dgwFormDetails.Columns[e.ColumnIndex].HeaderText.Equals("PublishedValue")) { if (e.Value == null || e.Value.ToString() == "") { strPubValue = "0"; } else { strPubValue = e.Value.ToString(); } switch (strPubValue) { case "0": dgwFormDetails.Rows[e.RowIndex].Cells[0].Style.BackColor = ClrPink; dgwFormDetails.Rows[e.RowIndex].Cells[1].Style.BackColor = ClrPink; dgwFormDetails.Rows[e.RowIndex].Cells[2].Style.BackColor = ClrPink; dgwFormDetails.Rows[e.RowIndex].Cells[3].Style.BackColor = ClrPink; dgwFormDetails.Rows[e.RowIndex].Cells[3].Value = imgInprocess; break; case "1": dgwFormDetails.Rows[e.RowIndex].Cells[0].Style.BackColor = ClrRed; dgwFormDetails.Rows[e.RowIndex].Cells[1].Style.BackColor = ClrRed; dgwFormDetails.Rows[e.RowIndex].Cells[2].Style.BackColor = ClrRed; dgwFormDetails.Rows[e.RowIndex].Cells[3].Style.BackColor = ClrRed; dgwFormDetails.Rows[e.RowIndex].Cells[3].Value = imgUnpublished; break; case "2": dgwFormDetails.Rows[e.RowIndex].Cells[0].Style.BackColor = System.Drawing.Color.Green; dgwFormDetails.Rows[e.RowIndex].Cells[1].Style.BackColor = System.Drawing.Color.Green; dgwFormDetails.Rows[e.RowIndex].Cells[2].Style.BackColor = System.Drawing.Color.Green; dgwFormDetails.Rows[e.RowIndex].Cells[3].Style.BackColor = System.Drawing.Color.Green; dgwFormDetails.Rows[e.RowIndex].Cells[3].Value = imgPublished; break; default: dgwFormDetails.Rows[e.RowIndex].Cells[0].Style.BackColor = ClrPink; dgwFormDetails.Rows[e.RowIndex].Cells[1].Style.BackColor = ClrPink; dgwFormDetails.Rows[e.RowIndex].Cells[2].Style.BackColor = ClrPink; dgwFormDetails.Rows[e.RowIndex].Cells[3].Style.BackColor = ClrPink; dgwFormDetails.Rows[e.RowIndex].Cells[3].Value = imgInprocess; break; } } } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this); } }
private void ShowGrid(DataTable theDT) { try { DataView TheDV = new DataView(theDT); // TheDV.Sort = "ListName"; IQCareUtils theUtils = new IQCareUtils(); theDT = theUtils.CreateTableFromDataView(TheDV); dgwMasterList.DataSource = null; DataGridViewTextBoxColumn col1 = new DataGridViewTextBoxColumn(); col1.HeaderText = "TableName"; col1.DataPropertyName = "TableName"; col1.Width = 225; col1.ReadOnly = true; col1.Visible = false; dgwMasterList.DataSource = null; DataGridViewTextBoxColumn col2 = new DataGridViewTextBoxColumn(); col2.HeaderText = "CategoryId"; col2.DataPropertyName = "CategoryId"; col2.Width = 225; col2.ReadOnly = true; col2.Visible = false; dgwMasterList.DataSource = null; DataGridViewTextBoxColumn col3 = new DataGridViewTextBoxColumn(); col3.HeaderText = "FormName"; col3.DataPropertyName = "FormName"; col3.Width = 225; col3.ReadOnly = true; col3.Visible = false; dgwMasterList.DataSource = null; DataGridViewTextBoxColumn col4 = new DataGridViewTextBoxColumn(); col4.HeaderText = "Master List Name"; col4.DataPropertyName = "ListName"; col4.Width = 780; col4.ReadOnly = true; col4.Visible = true; dgwMasterList.DataSource = null; DataGridViewTextBoxColumn col5 = new DataGridViewTextBoxColumn(); col5.HeaderText = "FeatureID"; col5.DataPropertyName = "FeatureID"; col5.Width = 225; col5.ReadOnly = true; col5.Visible = false; dgwMasterList.DataSource = null; DataGridViewTextBoxColumn col6 = new DataGridViewTextBoxColumn(); col6.HeaderText = "Update"; col6.DataPropertyName = "Update"; col6.Width = 225; col6.ReadOnly = true; col6.Visible = false; dgwMasterList.DataSource = null; DataGridViewTextBoxColumn col7 = new DataGridViewTextBoxColumn(); col7.HeaderText = "SystemId"; col7.DataPropertyName = "SystemId"; col7.Width = 225; col7.ReadOnly = true; col7.Visible = false; dgwMasterList.DataSource = null; DataGridViewTextBoxColumn col8 = new DataGridViewTextBoxColumn(); col8.HeaderText = "ModuleId"; col8.DataPropertyName = "ModuleId"; col8.Width = 225; col8.ReadOnly = true; col8.Visible = false; dgwMasterList.DataSource = null; DataGridViewTextBoxColumn col9 = new DataGridViewTextBoxColumn(); col9.HeaderText = "CountryID"; col9.DataPropertyName = "CountryID"; col9.Width = 225; col9.ReadOnly = true; col9.Visible = false; dgwMasterList.Columns.Add(col1); dgwMasterList.Columns.Add(col2); dgwMasterList.Columns.Add(col3); dgwMasterList.Columns.Add(col4); dgwMasterList.Columns.Add(col5); dgwMasterList.Columns.Add(col6); dgwMasterList.Columns.Add(col7); dgwMasterList.Columns.Add(col8); dgwMasterList.Columns.Add(col9); dgwMasterList.AutoGenerateColumns = false; dgwMasterList.DataSource = theDT; } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this); } }
public void ShowGrid(DataTable dt) { try { dgwFieldDetails.Columns.Clear(); dgwFieldDetails.DataSource = null; DataGridViewTextBoxColumn col1 = new DataGridViewTextBoxColumn(); col1.HeaderText = "Identifier Name"; col1.DataPropertyName = "IdentifierName"; col1.Width = 450; col1.ReadOnly = true; DataGridViewTextBoxColumn col2 = new DataGridViewTextBoxColumn(); col2.HeaderText = "Identifier Label"; col2.DataPropertyName = "Label"; col2.Width = 300; col2.ReadOnly = true; DataGridViewCheckBoxColumn col3 = new DataGridViewCheckBoxColumn(); col3.HeaderText = "Select"; col3.DataPropertyName = "Selected"; col3.Width = 150; if (GblIQCare.UpdateFlag == 1) { col3.ReadOnly = true; } else { col3.ReadOnly = false; } if ((GblIQCare.UpdateFlag == 1) && (GblIQCare.ModuleName == "SMART ART FORM")) { col3.ReadOnly = false; } DataGridViewTextBoxColumn col4 = new DataGridViewTextBoxColumn(); col4.HeaderText = ""; col4.DataPropertyName = "ID"; col4.Width = -1; col4.ReadOnly = true; col4.Visible = false; DataGridViewTextBoxColumn col5 = new DataGridViewTextBoxColumn(); col5.HeaderText = ""; col5.DataPropertyName = "FieldType"; col5.Width = -1; col5.ReadOnly = true; col5.Visible = false; DataGridViewTextBoxColumn col6 = new DataGridViewTextBoxColumn(); col6.HeaderText = ""; col6.DataPropertyName = "UpdateFlag"; col6.Width = -1; col6.ReadOnly = true; col6.Visible = false; dgwFieldDetails.AutoGenerateColumns = false; dgwFieldDetails.AllowUserToAddRows = false; dgwFieldDetails.DefaultCellStyle.ForeColor = System.Drawing.Color.Black; dgwFieldDetails.DefaultCellStyle.Font.Size.Equals(12); dgwFieldDetails.ColumnHeadersDefaultCellStyle.Font.Bold.Equals(true); dgwFieldDetails.Columns.Add(col1); dgwFieldDetails.Columns.Add(col2); dgwFieldDetails.Columns.Add(col3); dgwFieldDetails.Columns.Add(col4); dgwFieldDetails.Columns.Add(col5); dgwFieldDetails.Columns.Add(col6); dgwFieldDetails.DataSource = dt; } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this); } }
private void ShowGrid(DataTable theDT) { try { dgwExperyReport.Columns.Clear(); dgwExperyReport.DataSource = null; DataGridViewTextBoxColumn col1 = new DataGridViewTextBoxColumn(); col1.HeaderText = "Item Code"; col1.DataPropertyName = "ItemCode"; col1.Width = 120; col1.ReadOnly = true; col1.Visible = true; dgwExperyReport.DataSource = null; DataGridViewTextBoxColumn col2 = new DataGridViewTextBoxColumn(); col2.HeaderText = "Item Description"; col2.DataPropertyName = "ItemDescription"; col2.Width = 200; col2.ReadOnly = true; col2.Visible = true; dgwExperyReport.DataSource = null; DataGridViewTextBoxColumn col3 = new DataGridViewTextBoxColumn(); col3.HeaderText = "Batch No"; col3.DataPropertyName = "BatchNo"; col3.Width = 130; col3.ReadOnly = true; col3.Visible = true; dgwExperyReport.DataSource = null; DataGridViewTextBoxColumn col4 = new DataGridViewTextBoxColumn(); col4.HeaderText = "Quantity"; col4.DataPropertyName = "Quantityno"; col4.Width = 120; col4.ReadOnly = true; col4.Visible = true; dgwExperyReport.DataSource = null; DataGridViewTextBoxColumn col5 = new DataGridViewTextBoxColumn(); col5.HeaderText = "Dispensing Unit"; col5.DataPropertyName = "DispensingUnit"; col5.Width = 120; col5.ReadOnly = true; col5.Visible = true; dgwExperyReport.DataSource = null; DataGridViewTextBoxColumn col6 = new DataGridViewTextBoxColumn(); col6.HeaderText = "Expiry Date"; col6.DataPropertyName = "ExpiryDate"; col6.Width = 120; col6.ReadOnly = true; col6.Visible = true; dgwExperyReport.DataSource = null; DataGridViewTextBoxColumn col7 = new DataGridViewTextBoxColumn(); col7.HeaderText = "Total Purchase Price"; col7.DataPropertyName = "TotalPurchasePrice"; col7.Width = 133; col7.ReadOnly = true; col7.Visible = true; dgwExperyReport.Columns.Add(col1); dgwExperyReport.Columns.Add(col2); dgwExperyReport.Columns.Add(col3); dgwExperyReport.Columns.Add(col4); dgwExperyReport.Columns.Add(col5); dgwExperyReport.Columns.Add(col6); dgwExperyReport.Columns.Add(col7); dgwExperyReport.AutoGenerateColumns = false; dgwExperyReport.DataSource = theDT; } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this); } }
private void ShowGrid(DataTable theDT) { try { dgwDisposeItem.Columns.Clear(); dgwDisposeItem.DataSource = null; DataGridViewTextBoxColumn ItemCode = new DataGridViewTextBoxColumn(); ItemCode.HeaderText = "Item Code"; ItemCode.DataPropertyName = "ItemId"; ItemCode.Width = 50; ItemCode.ReadOnly = true; ItemCode.Visible = false; DataGridViewTextBoxColumn ItemName = new DataGridViewTextBoxColumn(); ItemName.HeaderText = "Item Name"; ItemName.DataPropertyName = "ItemName"; ItemName.Width = 270; ItemName.ReadOnly = true; DataGridViewTextBoxColumn BatchId = new DataGridViewTextBoxColumn(); BatchId.HeaderText = "Batch No"; BatchId.DataPropertyName = "BatchId"; BatchId.Width = 50; BatchId.ReadOnly = true; BatchId.Visible = false; DataGridViewTextBoxColumn BatchName = new DataGridViewTextBoxColumn(); BatchName.HeaderText = "Batch No."; BatchName.DataPropertyName = "BatchName"; BatchName.Width = 100; BatchName.ReadOnly = true; DataGridViewTextBoxColumn Quantity = new DataGridViewTextBoxColumn(); Quantity.HeaderText = "Quantity"; Quantity.DataPropertyName = "Quantity"; Quantity.Width = 70; Quantity.ReadOnly = true; DataGridViewTextBoxColumn DispensingUnit = new DataGridViewTextBoxColumn(); DispensingUnit.HeaderText = "Dispensing Unit"; DispensingUnit.DataPropertyName = "DispensingUnit"; DispensingUnit.Width = 120; DispensingUnit.ReadOnly = true; DataGridViewTextBoxColumn ExpiryDate = new DataGridViewTextBoxColumn(); ExpiryDate.HeaderText = "Expiry Date"; ExpiryDate.DataPropertyName = "ExpiryDate"; ExpiryDate.Width = 100; ExpiryDate.ReadOnly = true; DataGridViewTextBoxColumn TotalPurchasePrice = new DataGridViewTextBoxColumn(); TotalPurchasePrice.HeaderText = "Total Purchase Price"; TotalPurchasePrice.DataPropertyName = "TotPurcPrice"; TotalPurchasePrice.Width = 130; TotalPurchasePrice.ReadOnly = true; DataGridViewTextBoxColumn UnitPrice = new DataGridViewTextBoxColumn(); UnitPrice.HeaderText = "Unit Price"; UnitPrice.DataPropertyName = "DispensingUnitPrice"; UnitPrice.Width = 80; UnitPrice.ReadOnly = true; DataGridViewCheckBoxColumn chkDispose = new DataGridViewCheckBoxColumn(); chkDispose.HeaderText = "Dispose"; chkDispose.DataPropertyName = "Dispose"; chkDispose.Width = 80; dgwDisposeItem.Columns.Add(ItemCode); dgwDisposeItem.Columns.Add(ItemName); dgwDisposeItem.Columns.Add(BatchId); dgwDisposeItem.Columns.Add(BatchName); dgwDisposeItem.Columns.Add(Quantity); dgwDisposeItem.Columns.Add(DispensingUnit); dgwDisposeItem.Columns.Add(ExpiryDate); dgwDisposeItem.Columns.Add(TotalPurchasePrice); dgwDisposeItem.Columns.Add(UnitPrice); dgwDisposeItem.Columns.Add(chkDispose); dgwDisposeItem.AutoGenerateColumns = false; dgwDisposeItem.DataSource = theDT; } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this); } }
private void dgwModuleDetails_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { { try { Color ClrRed = Color.FromArgb(204, 0, 0); string strPubValue = ""; if (e.ColumnIndex != -1 && e.RowIndex != -1) { if (dgwModuleDetails.Columns[e.ColumnIndex].HeaderText.Equals("Status")) { if (e.Value == null || e.Value == "") { strPubValue = "0"; } else { strPubValue = e.Value.ToString(); } } else if (dgwModuleDetails.Rows.Count >= 1) { if (dgwModuleDetails.Rows[e.RowIndex].Cells[4].Value == "") { strPubValue = "0"; } else { strPubValue = dgwModuleDetails.Rows[e.RowIndex].Cells[4].Value.ToString(); } } } switch (strPubValue) { case "Un-Published": dgwModuleDetails.Rows[e.RowIndex].Cells[0].Style.BackColor = System.Drawing.Color.Red; dgwModuleDetails.Rows[e.RowIndex].Cells[1].Style.BackColor = System.Drawing.Color.Red; dgwModuleDetails.Rows[e.RowIndex].Cells[2].Style.BackColor = System.Drawing.Color.Red; dgwModuleDetails.Rows[e.RowIndex].Cells[3].Style.BackColor = System.Drawing.Color.Red; dgwModuleDetails.Rows[e.RowIndex].Cells[4].Style.BackColor = System.Drawing.Color.Red; break; case "Published": dgwModuleDetails.Rows[e.RowIndex].Cells[0].Style.BackColor = System.Drawing.Color.Green; dgwModuleDetails.Rows[e.RowIndex].Cells[1].Style.BackColor = System.Drawing.Color.Green; dgwModuleDetails.Rows[e.RowIndex].Cells[2].Style.BackColor = System.Drawing.Color.Green; dgwModuleDetails.Rows[e.RowIndex].Cells[3].Style.BackColor = System.Drawing.Color.Green; dgwModuleDetails.Rows[e.RowIndex].Cells[4].Style.BackColor = System.Drawing.Color.Green; break; } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this); } } }
private void ShowGrid(DataTable theDT) { try { dgwModuleDetails.DataSource = null; DataGridViewTextBoxColumn col1 = new DataGridViewTextBoxColumn(); col1.HeaderText = "Service"; col1.DataPropertyName = "ModuleName"; col1.Width = 200; col1.ReadOnly = true; DataGridViewTextBoxColumn col2 = new DataGridViewTextBoxColumn(); col2.HeaderText = "Patient Identifier"; col2.DataPropertyName = "PatientIdentifier"; col2.Width = 500; col2.ReadOnly = true; DataGridViewTextBoxColumn col3 = new DataGridViewTextBoxColumn(); col3.HeaderText = "Status"; col3.DataPropertyName = "Status"; col3.Width = 85; col3.ReadOnly = true; DataGridViewTextBoxColumn col4 = new DataGridViewTextBoxColumn(); col4.HeaderText = "ModuleId"; col4.DataPropertyName = "ModuleId"; col4.Width = 0; col4.Visible = false; DataGridViewTextBoxColumn col5 = new DataGridViewTextBoxColumn(); col5.HeaderText = "UpdateFlag"; col5.DataPropertyName = "UpdateFlag"; col5.Width = 0; col5.Visible = false; DataGridViewTextBoxColumn col6 = new DataGridViewTextBoxColumn(); col6.HeaderText = "Identifier"; col6.DataPropertyName = "Identifier"; col6.Width = 0; col6.Visible = false; DataGridViewTextBoxColumn col7 = new DataGridViewTextBoxColumn(); col7.HeaderText = "PharmacyFlag"; col7.DataPropertyName = "PharmacyFlag"; col7.Width = 0; col7.Visible = false; dgwModuleDetails.Columns.Add(col1); dgwModuleDetails.Columns.Add(col2); dgwModuleDetails.Columns.Add(col3); dgwModuleDetails.Columns.Add(col4); dgwModuleDetails.Columns.Add(col5); dgwModuleDetails.Columns.Add(col6); dgwModuleDetails.Columns.Add(col7); dgwModuleDetails.DataSource = theDT; } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this); } }
private void dgwModuleDetails_CellClick(object sender, DataGridViewCellEventArgs e) { int intUpdateflag; MsgBuilder theBuilder = new MsgBuilder(); if (e.RowIndex != -1) { intModuleId = Convert.ToInt32(dgwModuleDetails.Rows[e.RowIndex].Cells[0].Value); GblIQCare.UpdateFlag = Convert.ToInt32(dgwModuleDetails.Rows[e.RowIndex].Cells[4].Value); Status = Convert.ToString(dgwModuleDetails.Rows[e.RowIndex].Cells[3].Value); } if (e.ColumnIndex == -1) { return; } if (GblIQCare.UpdateFlag == 1) { return; } if (dgwModuleDetails.Columns[e.ColumnIndex].HeaderText == "Status") { if ((Status == "Published") || (Status == "Un-Published")) { IModule objIdentifier; DialogResult strResult; if (Status == "Published") { theBuilder.DataElements["PgStatus"] = "UnPublish"; } else { theBuilder.DataElements["PgStatus"] = "Publish"; } strResult = IQCareWindowMsgBox.ShowWindowConfirm("Publish", theBuilder, this); if (strResult == DialogResult.No) { return; } if (strResult.ToString() == "Yes") { if (Status == "Published") { Hashtable theHT = new Hashtable(); theHT.Add("ModuleID", intModuleId); theHT.Add("Status", 1); theHT.Add("DeleteFlag", 0); theHT.Add("UserID", GblIQCare.AppUserId); DataTable theDT = new DataTable(); objIdentifier = (IModule)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BModule, BusinessProcess.FormBuilder"); Int32 intExistModuleId = objIdentifier.StatusUpdate(theHT); BindGrid(); } if (Status == "Un-Published") { Hashtable theHT = new Hashtable(); theHT.Add("ModuleID", intModuleId); theHT.Add("Status", 2); theHT.Add("DeleteFlag", 0); theHT.Add("UserID", GblIQCare.AppUserId); DataTable theDT = new DataTable(); objIdentifier = (IModule)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BModule, BusinessProcess.FormBuilder"); Int32 intExistModuleId = objIdentifier.StatusUpdate(theHT); BindGrid(); } } } } }
private void btnSave_Click(object sender, EventArgs e) { try { if (Validation() == false) { return; } DataTable dtFeature; dtFeature = clsCommon.CreateTableMstFeature(); DataRow theDRFeature; int iFormId; theDRFeature = dtFeature.NewRow(); string FName = cmbHomePageType.Text.Trim() + "-" + cmbTechnicalArea.Text.Trim(); if (GblIQCare.iHomePageId != 0) { iFormId = GblIQCare.iHomePageId; Flag = PMTCTConstants.strUpdate; } else { iFormId = 0; Flag = PMTCTConstants.strInsert; } if (dgwQueryDetails.Rows.Count <= 1) { IQCareWindowMsgBox.ShowWindow("IndicatorMandatory", this); return; } theDRFeature["FeatureId"] = iFormId; theDRFeature["FeatureName"] = cmbHomePageType.Text + "-" + cmbTechnicalArea.Text; theDRFeature["UserId"] = GblIQCare.AppUserId; theDRFeature["ModuleId"] = cmbTechnicalArea.SelectedValue; dtFeature.Rows.Add(theDRFeature); DataTable dtMstHomePage = new DataTable(); DataColumn theDT; theDT = new DataColumn(); theDT.DataType = Type.GetType("System.Int32"); theDT.ColumnName = "Id"; dtMstHomePage.Columns.Add(theDT); theDT = new DataColumn(); theDT.DataType = Type.GetType("System.String"); theDT.ColumnName = "Name"; dtMstHomePage.Columns.Add(theDT); theDT = new DataColumn(); theDT.DataType = Type.GetType("System.Int32"); theDT.ColumnName = "FeatureId"; dtMstHomePage.Columns.Add(theDT); theDT = new DataColumn(); theDT.DataType = Type.GetType("System.Int32"); theDT.ColumnName = "UserId"; dtMstHomePage.Columns.Add(theDT); DataRow theDRHomePage; theDRHomePage = dtMstHomePage.NewRow(); if (GblIQCare.iHomePageId != 0) { theDRHomePage["Id"] = ID; } theDRHomePage["Name"] = txtSectionTitle.Text; theDRHomePage["FeatureId"] = iFormId; theDRHomePage["UserId"] = GblIQCare.AppUserId; dtMstHomePage.Rows.Add(theDRHomePage); DataTable dtlHomePage; dtlHomePage = (DataTable)dgwQueryDetails.DataSource; DataTable dtDtHomePage; dtDtHomePage = dtlHomePage.Copy(); DataSet dsSaveIndicatorQuery = new DataSet(); dsSaveIndicatorQuery.Tables.Add(dtDtHomePage); dsSaveIndicatorQuery.Tables.Add(dtFeature); dsSaveIndicatorQuery.Tables.Add(dtMstHomePage); foreach (DataRow theDR in dtDtHomePage.Rows) { if (theDR["Indicator"].ToString() == "") { IQCareWindowMsgBox.ShowWindow("BlankIndicator", this); return; } } IHomePageConfiguration objTechArea = (IHomePageConfiguration)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BHomePageConfiguration,BusinessProcess.FormBuilder"); int iSave = (int)objTechArea.SaveHomePageIndicator(dsSaveIndicatorQuery, Flag); btnCancel_Click(sender, e); } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindow("#C1", theBuilder, this); return; } }
private void btnSave_Click(object sender, EventArgs e) { // if (GblIQCare.ItemFeatureId == 144) // { if (ddlSupplierName.SelectedValue.ToString() == "0") { //IQCareWindowMsgBox.ShowWindow("SupplierName", this); MsgBuilder theBuilder = new MsgBuilder(); if (GblIQCare.ItemFeatureId == 144) { theBuilder.DataElements["Control"] = "Supplier Name"; } else if (GblIQCare.ItemFeatureId == 149) { theBuilder.DataElements["Control"] = "Store Name"; } IQCareWindowMsgBox.ShowWindow("BlankDropDown", theBuilder, this); ddlSupplierName.Focus(); return; } if (ddlItemType.SelectedValue.ToString() == "0") { //IQCareWindowMsgBox.ShowWindow("ItemTypeSelect", this); MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Item type"; IQCareWindowMsgBox.ShowWindow("BlankDropDown", theBuilder, this); ddlItemType.Focus(); return; } // } try { DtItem = CreateItemTable(); arrItemList = new ArrayList(); for (int i = 0; i < chkItemList.Items.Count; i++) { if (chkItemList.GetItemChecked(i) == true) { DataRow theDR = DtItem.NewRow(); theDR["ItemID"] = Convert.ToInt32((((System.Data.DataRowView)(chkItemList.Items[i])).Row.ItemArray[0]).ToString()); DataView theDV = new DataView(theItemList); theDV.RowFilter = "ItemID =" + theDR["ItemID"].ToString(); // arrItemList.Add((((System.Data.DataRowView)(chkItemList.Items[i])).Row.ItemArray[0]).ToString()); DtItem.Rows.Add(theDR); } } IMasterList objMasterlist = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM"); int ret = 0; if (GblIQCare.ItemFeatureId == 144) { ret = objMasterlist.SaveSupplierItemList(DtItem, Convert.ToInt32(ddlItemType.SelectedValue), GblIQCare.AppUserId, Convert.ToInt32(ddlSupplierName.SelectedValue)); ddlSupplierName.SelectedValue = 0; ddlItemType.SelectedValue = 0; ddlItemSubType.SelectedValue = 0; } else if (GblIQCare.ItemFeatureId == 149) { // ret = objMasterlist.SaveStoreItemList(DtItem, GblIQCare.AppUserId, Convert.ToInt32(ddlSupplierName.SelectedValue)); ret = objMasterlist.SaveStoreItemList_Filtered(DtItem, GblIQCare.AppUserId, Convert.ToInt32(ddlSupplierName.SelectedValue), Convert.ToInt32(ddlItemType.SelectedValue)); ddlSupplierName.SelectedValue = 0; ddlItemType.SelectedValue = 0; ddlItemSubType.SelectedValue = 0; } // BindItemListStore(0); if (ret > 0) { IQCareWindowMsgBox.ShowWindow("ProgramSave", this); chkItemList.DataSource = null; chkItemList.Items.Clear(); return; } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this); } }
/// <summary> /// Saves the update module. /// </summary> public void SaveUpdateModule() { string Anthem = "Star Spangled Banner"; Anthem = Anthem.Replace(" ", ""); Hashtable theHT = new Hashtable(); theHT.Clear(); IModule objIdentifier; strModuleName = ""; strModuleName = txtModuleName.Text; string strDisplayName = textDisplayName.Text; bool canEnrol = chkEnroll.Checked; Int32 pharmacyFlag = 0; //if (chkHivCareTrmt.Checked) //{ pharmacyFlag = GblIQCare.PharmacyFlag; //} //if (GblIQCare.ModuleName != "SMART ART FORM") //{ // strModuleName = txtModuleName.Text.Replace(" ", ""); //} //else //{ // strModuleName = txtModuleName.Text; //} if ((GblIQCare.ModuleId == 0) && (intOldModuleId != 0) && (strOldModuleName == strModuleName)) { theHT.Add("ModuleId", intOldModuleId); } else { strOldModuleName = strModuleName; theHT.Add("ModuleId", GblIQCare.ModuleId); } theHT.Add("ModuleName", strModuleName); theHT.Add("DisplayName", strDisplayName); theHT.Add("CanEnroll", canEnrol); theHT.Add("Status", 1); theHT.Add("DeleteFlag", 0); theHT.Add("UserID", GblIQCare.AppUserId); theHT.Add("PharmacyFlag", pharmacyFlag); objIdentifier = (IModule)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BModule, BusinessProcess.FormBuilder"); Int32 intExistModuleId = objIdentifier.SaveUpdateModuleDetail(theHT, dtSubmit, GblIQCare.dtServiceBusinessValues); intOldModuleId = intExistModuleId; if (intExistModuleId == 0) { IQCareWindowMsgBox.ShowWindow("ModuleExist", this); return; } else { Form theForm; theForm = (Form)Activator.CreateInstance(Type.GetType("IQCare.FormBuilder.frmModule, IQCare.FormBuilder")); theForm.MdiParent = this.MdiParent; theForm.Left = 0; theForm.Top = 0; theForm.Focus(); theForm.Show(); this.Close(); } }
private void btnAdd_Click(object sender, EventArgs e) { if (GblIQCare.blnOtherICD10) { foreach (TreeNode child in TVICD10.Nodes) { if (child.Checked) { int Id = Convert.ToInt32(child.Tag); string Name = Convert.ToString(child.Text).Replace("'", "''"); Name = Name.Replace("''", "'"); if (theDTICD10.Rows.Count > 0) { DataRow[] row = theDTICD10.Select("ICD10Name='" + Name + "' and Deleteflag=0"); if (row.Length > 0) { IQCareWindowMsgBox.ShowWindow("DuplicateICD10", this); return; } } theDTICD10.Rows.Add(0, 0, 0, Name, 0, Id); theDTICD10.AcceptChanges(); DataView dv = new DataView(theDTICD10); dv.RowFilter = "Deleteflag=0"; lbICD10.DataSource = dv; lbICD10.DisplayMember = "ICD10Name"; } } } if (GblIQCare.blnICD10multiselect) { if (TVICD10.SelectedNode != null) { int Id = Convert.ToInt32(TVICD10.SelectedNode.Tag); string Name = Convert.ToString(TVICD10.SelectedNode.Text).Replace("'", "''"); if (theDTICD10.Rows.Count > 0) { DataRow[] row = theDTICD10.Select("ICD10Name='" + Name + "' and Deleteflag=0"); if (row.Length > 0) { IQCareWindowMsgBox.ShowWindow("DuplicateICD10", this); return; } } int number = TVICD10.SelectedNode.Level; Name = Name.Replace("''", "'"); switch (number) { case 1: theDTICD10.Rows.Add(Id, 0, 0, Name, 0, 0); theDTICD10.AcceptChanges(); break; case 2: theDTICD10.Rows.Add(0, Id, 0, Name, 0, 0); theDTICD10.AcceptChanges(); break; case 3: theDTICD10.Rows.Add(0, 0, Id, Name, 0, 0); theDTICD10.AcceptChanges(); break; case 0: if (GblIQCare.blnOtherICD10) { theDTICD10.Rows.Add(0, 0, 0, Name, 0, Id); theDTICD10.AcceptChanges(); } break; } DataView dv = new DataView(theDTICD10); dv.RowFilter = "Deleteflag=0"; lbICD10.DataSource = dv; lbICD10.DisplayMember = "ICD10Name"; } } }
/// <summary> /// Shows the grid. /// </summary> /// <param name="dt">The dt.</param> public void ShowGrid(DataTable dt) { try { dgwFieldDetails.Columns.Clear(); dgwFieldDetails.DataSource = null; DataGridViewTextBoxColumn colIdentifierName = new DataGridViewTextBoxColumn(); colIdentifierName.HeaderText = "Identifier Name"; colIdentifierName.DataPropertyName = "IdentifierName"; colIdentifierName.Name = "IdentifierName"; colIdentifierName.Width = 200; colIdentifierName.ReadOnly = true; DataGridViewTextBoxColumn colIdentifierLabel = new DataGridViewTextBoxColumn(); colIdentifierLabel.HeaderText = "Identifier Label"; colIdentifierLabel.Name = colIdentifierLabel.DataPropertyName = "Label"; colIdentifierLabel.Width = 250; colIdentifierLabel.ReadOnly = true; DataGridViewCheckBoxColumn colSelected = new DataGridViewCheckBoxColumn(); colSelected.HeaderText = "Select"; colSelected.DataPropertyName = "Selected"; colSelected.Name = "Selected"; colSelected.Width = 100; if (GblIQCare.UpdateFlag == 1) { colSelected.ReadOnly = true; } else { colSelected.ReadOnly = false; } if ((GblIQCare.UpdateFlag == 1) && (GblIQCare.ModuleName == "SMART ART FORM")) { colSelected.ReadOnly = false; } DataGridViewCheckBoxColumn colRequired = new DataGridViewCheckBoxColumn(); colRequired.HeaderText = "Required"; colRequired.Name = colRequired.DataPropertyName = "Required"; colRequired.Width = 100; colRequired.ReadOnly = false; DataGridViewTextBoxColumn colId = new DataGridViewTextBoxColumn(); colId.HeaderText = ""; colId.Name = colId.DataPropertyName = "ID"; colId.Width = -1; colId.ReadOnly = true; colId.Visible = false; DataGridViewTextBoxColumn colFieldTypeId = new DataGridViewTextBoxColumn(); colFieldTypeId.HeaderText = ""; colFieldTypeId.Name = colFieldTypeId.DataPropertyName = "FieldType"; colFieldTypeId.Width = -1; colFieldTypeId.ReadOnly = true; colFieldTypeId.Visible = false; DataGridViewTextBoxColumn colFieldTypeName = new DataGridViewTextBoxColumn(); colFieldTypeName.HeaderText = "Data Type"; colFieldTypeName.Name = colFieldTypeName.DataPropertyName = "FieldTypeName"; colFieldTypeName.Width = 150; colFieldTypeName.ReadOnly = true; colFieldTypeName.Visible = true; DataGridViewTextBoxColumn colUpdateFlag = new DataGridViewTextBoxColumn(); colUpdateFlag.HeaderText = ""; colUpdateFlag.Name = colUpdateFlag.DataPropertyName = "UpdateFlag"; colUpdateFlag.Width = -1; colUpdateFlag.ReadOnly = true; colUpdateFlag.Visible = false; dgwFieldDetails.AutoGenerateColumns = false; dgwFieldDetails.AllowUserToAddRows = false; dgwFieldDetails.DefaultCellStyle.ForeColor = System.Drawing.Color.Black; dgwFieldDetails.DefaultCellStyle.Font.Size.Equals(12); dgwFieldDetails.ColumnHeadersDefaultCellStyle.Font.Bold.Equals(true); dgwFieldDetails.Columns.Add(colId); dgwFieldDetails.Columns.Add(colIdentifierName); dgwFieldDetails.Columns.Add(colIdentifierLabel); dgwFieldDetails.Columns.Add(colFieldTypeId); dgwFieldDetails.Columns.Add(colFieldTypeName); dgwFieldDetails.Columns.Add(colSelected); dgwFieldDetails.Columns.Add(colRequired); dgwFieldDetails.Columns.Add(colUpdateFlag); dgwFieldDetails.DataSource = dt; } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this); } }
private void btnOK_Click(object sender, EventArgs e) { if (ddlStoreName.SelectedValue.ToString() == "0") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Store Name"; IQCareWindowMsgBox.ShowWindow("BlankDropDown", theBuilder, this); ddlStoreName.Focus(); return; } GblIQCare.intStoreId = Convert.ToInt32(ddlStoreName.SelectedValue); if ((GblIQCare.theArea == "PO") || (GblIQCare.theArea == "CR")) { DataTable theDT = (DataTable)ddlStoreName.DataSource; DataView theDV = new DataView(theDT); theDV.RowFilter = "StoreId=" + ddlStoreName.SelectedValue.ToString() + " and CentralStore=1"; if (theDV.Count < 1) { //IQCareWindowMsgBox.ShowWindow("StoreNotAuthorize", this); //return; GblIQCare.ModePurchaseOrder = 2; } else { GblIQCare.ModePurchaseOrder = 1; } Form theForm = (Form)Activator.CreateInstance(Type.GetType("IQCare.SCM.frmViewPurchaseOrder, IQCare.SCM")); theForm.Top = 2; theForm.Left = 2; theForm.MdiParent = this.MdiParent; theForm.Show(); this.Close(); } if (GblIQCare.theArea == "Dispense") { DataTable theDT = (DataTable)ddlStoreName.DataSource; DataView theDV = new DataView(theDT); theDV.RowFilter = "StoreId=" + ddlStoreName.SelectedValue.ToString() + " and DispensingStore=1"; if (theDV.Count < 1) { IQCareWindowMsgBox.ShowWindow("StoreNotAuthorize", this); return; } Form theForm = (Form)Activator.CreateInstance(Type.GetType("IQCare.SCM.frmPatientDrugDispense, IQCare.SCM")); theForm.Top = 2; theForm.Left = 2; theForm.MdiParent = this.MdiParent; theForm.Show(); this.Close(); } if ((GblIQCare.theArea == "GRN") || (GblIQCare.theArea == "IV")) { DataTable theDT = (DataTable)ddlStoreName.DataSource; DataView theDV = new DataView(theDT); theDV.RowFilter = "StoreId=" + ddlStoreName.SelectedValue.ToString() + " and CentralStore=1"; if (theDV.Count < 1) { //IQCareWindowMsgBox.ShowWindow("StoreNotAuthorize", this); //return; GblIQCare.ModePurchaseOrder = 2; } else { GblIQCare.ModePurchaseOrder = 1; } Form theForm = (Form)Activator.CreateInstance(Type.GetType("IQCare.SCM.frmViewGoodReceiveNote, IQCare.SCM")); theForm.Top = 2; theForm.Left = 2; theForm.MdiParent = this.MdiParent; theForm.Show(); this.Close(); } }
public void SaveUpdateModule() { string Anthem = "Star Spangled Banner"; Anthem = Anthem.Replace(" ", ""); Hashtable theHT = new Hashtable(); theHT.Clear(); IModule objIdentifier; strModuleName = ""; strModuleName = txtModuleName.Text; Int32 pharmacyFlag = 0; if (chkHivCareTrmt.Checked) { pharmacyFlag = 1; } //if (GblIQCare.ModuleName != "SMART ART FORM") //{ // strModuleName = txtModuleName.Text.Replace(" ", ""); //} //else //{ // strModuleName = txtModuleName.Text; //} //By Akhil - To prevent duplicate service name from Form - 3rd April 2014 IModule objModuleDetail; objModuleDetail = (IModule)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BModule,BusinessProcess.FormBuilder"); DataSet objDsModuleDetails = objModuleDetail.GetModuleDetail(); string s = txtModuleName.Text.Trim(); if (objDsModuleDetails.Tables != null && objDsModuleDetails.Tables[0].Rows.Count > 0) { DataRow[] dr = objDsModuleDetails.Tables[0].Select("ModuleName = '" + s + "'"); if (GblIQCare.ModuleId == 0) { if (dr.Length > 0) { IQCareWindowMsgBox.ShowWindow("ModuleExist", this); return; } } } if ((GblIQCare.ModuleId == 0) && (intOldModuleId != 0) && (strOldModuleName == strModuleName)) { theHT.Add("ModuleId", intOldModuleId); } else { strOldModuleName = strModuleName; theHT.Add("ModuleId", GblIQCare.ModuleId); } theHT.Add("ModuleName", strModuleName); theHT.Add("Status", 1); theHT.Add("DeleteFlag", 0); theHT.Add("UserID", GblIQCare.AppUserId); theHT.Add("PharmacyFlag", pharmacyFlag); objIdentifier = (IModule)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BModule, BusinessProcess.FormBuilder"); Int32 intExistModuleId = objIdentifier.SaveUpdateModuleDetail(theHT, dtSubmit, GblIQCare.dtServiceBusinessValues); intOldModuleId = intExistModuleId; if (intExistModuleId == 0) { IQCareWindowMsgBox.ShowWindow("ModuleExist", this); return; } else { Form theForm; theForm = (Form)Activator.CreateInstance(Type.GetType("IQCare.FormBuilder.frmModule, IQCare.FormBuilder")); theForm.MdiParent = this.MdiParent; theForm.Left = 0; theForm.Top = 0; theForm.Focus(); theForm.Show(); this.Close(); } }
private void btnOk_Click(object sender, EventArgs e) { try { StringBuilder theErrorMsg = new StringBuilder(); if (txtNewCategory.Visible == true && txtNewCategory.Text.Trim() == "") { theErrorMsg.Append("Category cannot be blank.").AppendLine(); } if (Convert.ToInt32(cmbCategory.SelectedValue) < 1 && txtNewCategory.Visible == false) { theErrorMsg.Append("Select the Category first.").AppendLine(); } if (txtReportName.Text.Trim() == "") { theErrorMsg.Append("Report Name cannot be Blank.").AppendLine(); } if (txtQBQuery.Text.Trim() == "") { MessageBox.Show("Query cannot be blank"); } if (theErrorMsg.Length > 0) { MessageBox.Show("Following are mandatory:" + theErrorMsg.ToString(), "IQCare Management", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Validation() == false) { return; } string CategoryName = ""; if (Convert.ToInt32(cmbCategory.SelectedValue) > 0) { CategoryName = cmbCategory.Text; } else { CategoryName = txtNewCategory.Text; } if (CategoryId == 0) { CategoryId = cmbCategory.SelectedIndex; } QBControl.SQL = txtQBQuery.Text.Trim(); ActiveDatabaseSoftware.ActiveQueryBuilder.ParameterList pl = QBControl.Parameters; XElement xmlDoc = null; if (pl != null) { var x = (from p in pl select p); xmlDoc = new XElement("parameters", from p in pl select new XElement("parameter", new XElement("name", p.FullName), new XElement("datatype", p.DataType.ToString()), new XElement("datatype2", p.DataType.GetType().ToString()), new XElement("comparedfield", p.ComparedField), new XElement("symbol", p.Symbol), new XElement("basetype", this.GetSqlDBTypeFromstring(p.MetadataField.FieldTypeName)))); } if (xmlDoc == null) { IQueryBuilder theQBuilder = (IQueryBuilder)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BQueryBuilder, BusinessProcess.FormBuilder"); DataTable theDT = theQBuilder.SaveCustomReport(ReportId, CategoryId, CategoryName, txtReportName.Text, txtQBQuery.Text.Trim(), GblIQCare.AppUserId); ReportId = Convert.ToInt32(theDT.Rows[0][0]); CategoryId = Convert.ToInt32(theDT.Rows[0][1]); RepName = theDT.Rows[0][2].ToString(); QBControl.Enabled = true; pnlSave.Visible = false; } else { IQueryBuilder theQBuilder = (IQueryBuilder)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BQueryBuilder, BusinessProcess.FormBuilder"); DataTable theDT = theQBuilder.SaveCustomReport(ReportId, CategoryId, CategoryName, txtReportName.Text, txtQBQuery.Text.Trim(), GblIQCare.AppUserId, xmlDoc.ToString()); ReportId = Convert.ToInt32(theDT.Rows[0][0]); CategoryId = Convert.ToInt32(theDT.Rows[0][1]); RepName = theDT.Rows[0][2].ToString(); QBControl.Enabled = true; pnlSave.Visible = false; } } catch (Exception err) { MsgBuilder Builder = new MsgBuilder(); Builder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindow("#C1", Builder, this); return; } }
/// <summary> /// This function is used to create datagrid column on runtime /// </summary> /// <param name="ds"></param> public void ShowGrid(DataTable dt) { try { dgwFormDetails.DataSource = null; DataGridViewTextBoxColumn col1 = new DataGridViewTextBoxColumn(); col1.HeaderText = "Form Name"; col1.DataPropertyName = "FormName"; col1.Width = 250; col1.ReadOnly = true; DataGridViewTextBoxColumn col2 = new DataGridViewTextBoxColumn(); col2.HeaderText = "Updated By"; col2.DataPropertyName = "UpdatedBy"; col2.Width = 140; col2.ReadOnly = true; DataGridViewTextBoxColumn col3 = new DataGridViewTextBoxColumn(); col3.HeaderText = "Last Updated"; col3.DataPropertyName = "LastUpdate"; col3.Width = 135; col3.ReadOnly = true; DataGridViewImageColumn col4 = new DataGridViewImageColumn(); col4.HeaderText = "Published"; col4.Width = 90; col4.ReadOnly = false; DataGridViewTextBoxColumn col5 = new DataGridViewTextBoxColumn(); col5.HeaderText = "PublishedValue"; col5.DataPropertyName = "Published"; col5.Width = 0; col5.ReadOnly = false; DataGridViewTextBoxColumn col6 = new DataGridViewTextBoxColumn(); col6.HeaderText = "Service Area"; col6.DataPropertyName = "ServiceArea"; col6.Width = 280; col6.ReadOnly = true; dgwFormDetails.AutoGenerateColumns = false; dgwFormDetails.AllowUserToAddRows = false; dgwFormDetails.DefaultCellStyle.ForeColor = System.Drawing.Color.Black; dgwFormDetails.DefaultCellStyle.Font.Size.Equals(12); dgwFormDetails.ColumnHeadersDefaultCellStyle.Font.Bold.Equals(true); dgwFormDetails.Columns.Add(col1); dgwFormDetails.Columns.Add(col6); dgwFormDetails.Columns.Add(col2); dgwFormDetails.Columns.Add(col3); dgwFormDetails.Columns.Add(col4); dgwFormDetails.Columns.Add(col5); dgwFormDetails.DataSource = dt; } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this); } }
private void btnExport_Click(object sender, EventArgs e) { if (chkLstBoxForms.CheckedItems.Count > 0) { DataSet dsCollectDataToSave = new DataSet(); IImportExportForms objExportFormDetails; objExportFormDetails = (IImportExportForms)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BImportExportForms,BusinessProcess.FormBuilder"); for (int i = 0; i < chkLstBoxForms.CheckedItems.Count; i++) { if (ddlFormType.Text.ToString() == "" || ddlFormType.SelectedItem.ToString() == "Forms") { objDsFormDetails = objExportFormDetails.GetImportExportFormDetail(chkLstBoxForms.CheckedItems[i].ToString()); if (dsCollectDataToSave.Tables.Count == 0) { ////mst_feature dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[0].Copy()); ////mst_section dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[1].Copy()); ////lnk_forms dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[2].Copy()); ////Select List Val only for custom fields dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[3].Copy()); ////Business Rule only for custom fields dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[4].Copy()); ////mst_module-tech area dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[5].Copy()); ////module identifier dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[6].Copy()); ////Conditional Fields dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[7].Copy()); ////Select List Val only for Conditional custom fields dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[8].Copy()); ////Business Rule only for Conditional custom fields dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[9].Copy()); ////APPAdmin for Version Check dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[10].Copy()); ////Field ICD Code Linking Table dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[11].Copy()); ////Master Table for Tabs dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[12].Copy()); ////Linking Table for Tabs and Section Id dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[13].Copy()); ////Special form linking dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[14].Copy()); ////Form Verioning dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[15].Copy()); } else { foreach (DataRow dr in objDsFormDetails.Tables[0].Rows) { dsCollectDataToSave.Tables[0].ImportRow(dr); } foreach (DataRow dr in objDsFormDetails.Tables[1].Rows) { dsCollectDataToSave.Tables[1].ImportRow(dr); } foreach (DataRow dr in objDsFormDetails.Tables[2].Rows) { dsCollectDataToSave.Tables[2].ImportRow(dr); } foreach (DataRow dr in objDsFormDetails.Tables[3].Rows) { dsCollectDataToSave.Tables[3].ImportRow(dr); } foreach (DataRow dr in objDsFormDetails.Tables[4].Rows) { dsCollectDataToSave.Tables[4].ImportRow(dr); } foreach (DataRow dr in objDsFormDetails.Tables[5].Rows) { dsCollectDataToSave.Tables[5].ImportRow(dr); } foreach (DataRow dr in objDsFormDetails.Tables[6].Rows) { dsCollectDataToSave.Tables[6].ImportRow(dr); } foreach (DataRow dr in objDsFormDetails.Tables[7].Rows) { dsCollectDataToSave.Tables[7].ImportRow(dr); } foreach (DataRow dr in objDsFormDetails.Tables[8].Rows) { dsCollectDataToSave.Tables[8].ImportRow(dr); } foreach (DataRow dr in objDsFormDetails.Tables[9].Rows) { dsCollectDataToSave.Tables[9].ImportRow(dr); } foreach (DataRow dr in objDsFormDetails.Tables[10].Rows) { dsCollectDataToSave.Tables[10].ImportRow(dr); } foreach (DataRow dr in objDsFormDetails.Tables[11].Rows) { dsCollectDataToSave.Tables[11].ImportRow(dr); } foreach (DataRow dr in objDsFormDetails.Tables[12].Rows) { dsCollectDataToSave.Tables[12].ImportRow(dr); } foreach (DataRow dr in objDsFormDetails.Tables[13].Rows) { dsCollectDataToSave.Tables[13].ImportRow(dr); } foreach (DataRow dr in objDsFormDetails.Tables[14].Rows) { dsCollectDataToSave.Tables[14].ImportRow(dr); } foreach (DataRow dr in objDsFormDetails.Tables[15].Rows) { dsCollectDataToSave.Tables[15].ImportRow(dr); } } } else //export only home pages { objDsFormDetails = objExportFormDetails.GetImportExportHomeFormDetail(chkLstBoxForms.CheckedItems[i].ToString()); if (dsCollectDataToSave.Tables.Count == 0) { ////mst_feature dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[0].Copy()); ////mst_section dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[1].Copy()); ////lnk_forms dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[2].Copy()); //////Select List Val only for custom fields //dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[3].Copy()); //////Business Rule only for custom fields //dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[4].Copy()); //////mst_module-tech area //dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[5].Copy()); //////module identifier //dsCollectDataToSave.Tables.Add(objDsFormDetails.Tables[6].Copy()); } else { foreach (DataRow dr in objDsFormDetails.Tables[0].Rows) { dsCollectDataToSave.Tables[0].ImportRow(dr); } foreach (DataRow dr in objDsFormDetails.Tables[1].Rows) { dsCollectDataToSave.Tables[1].ImportRow(dr); } foreach (DataRow dr in objDsFormDetails.Tables[2].Rows) { dsCollectDataToSave.Tables[2].ImportRow(dr); } } } } FileDialog oDialog = new SaveFileDialog(); oDialog.DefaultExt = "xml"; oDialog.FileName = "Export Form-" + DateTime.Today.ToString("ddMMMyyyy") + ".xml"; oDialog.Filter = "Form (*.xml)|*.xml"; if (oDialog.ShowDialog() == DialogResult.OK) { string strFilename = oDialog.FileName; dsCollectDataToSave.WriteXml(strFilename); } } else { IQCareWindowMsgBox.ShowWindow("SelectForm", this); txtFileName.Focus(); } }
private void CreateGrid() { try { //IMasterList objPODetails = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM"); IPurchase objPODetails = (IPurchase)ObjectFactory.CreateInstance("BusinessProcess.SCM.BPurchase,BusinessProcess.SCM"); DataTable theDTPODetails = objPODetails.GetPurchaseOrderDetails(GblIQCare.AppUserId, GblIQCare.intStoreId, GblIQCare.AppLocationId); dgwPurchaseOrder.Columns.Clear(); dgwPurchaseOrder.AutoGenerateColumns = false; dgwPurchaseOrder.AllowUserToAddRows = false; DataGridViewTextBoxColumn theColumnPoId = new DataGridViewTextBoxColumn(); // theColumnItemCode.HeaderText = "Item Code"; theColumnPoId.Name = "POId"; theColumnPoId.DataPropertyName = "POId"; DataGridViewTextBoxColumn theColumnStatus = new DataGridViewTextBoxColumn(); // theColumnItemCode.HeaderText = "Item Code"; theColumnStatus.Name = "Status"; theColumnStatus.DataPropertyName = "Status"; theColumnStatus.Width = 143; DataGridViewTextBoxColumn theColumnOrderNumber = new DataGridViewTextBoxColumn(); theColumnOrderNumber.HeaderText = "Order Number"; theColumnOrderNumber.Name = "OrderNo"; theColumnOrderNumber.DataPropertyName = "OrderNo"; theColumnOrderNumber.Width = 130; theColumnOrderNumber.ReadOnly = true; DataGridViewTextBoxColumn theColumnPODate = new DataGridViewTextBoxColumn(); theColumnPODate.HeaderText = "Order Date"; theColumnPODate.DataPropertyName = "OrderDate"; theColumnPODate.Name = "OrderDate"; theColumnPODate.Width = 140; theColumnPODate.ReadOnly = true; DataGridViewTextBoxColumn theColumnSupplier = new DataGridViewTextBoxColumn(); theColumnSupplier.HeaderText = "Supplier"; theColumnSupplier.DataPropertyName = "SupplierName"; theColumnSupplier.Name = "SupplierName"; theColumnSupplier.Width = 175; theColumnSupplier.ReadOnly = true; DataGridViewTextBoxColumn theColumnSourceStore = new DataGridViewTextBoxColumn(); theColumnSourceStore.HeaderText = "Source Store"; theColumnSourceStore.DataPropertyName = "SourceName"; theColumnSourceStore.Name = "SourceName"; theColumnSourceStore.Width = 180; theColumnSourceStore.ReadOnly = true; DataGridViewTextBoxColumn theColumnDestStore = new DataGridViewTextBoxColumn(); theColumnDestStore.HeaderText = "Destination Store"; theColumnDestStore.DataPropertyName = "DestStore"; theColumnDestStore.Name = "DestStore"; theColumnDestStore.Width = 180; theColumnDestStore.ReadOnly = true; dgwPurchaseOrder.DataSource = theDTPODetails; dgwPurchaseOrder.Columns.Add(theColumnPoId); dgwPurchaseOrder.Columns.Add(theColumnOrderNumber); dgwPurchaseOrder.Columns.Add(theColumnPODate); dgwPurchaseOrder.Columns.Add(theColumnSupplier); dgwPurchaseOrder.Columns.Add(theColumnSourceStore); dgwPurchaseOrder.Columns.Add(theColumnDestStore); dgwPurchaseOrder.Columns.Add(theColumnStatus); theColumnPoId.Visible = false; if (GblIQCare.theArea == "PO") { theColumnSourceStore.Visible = false; theColumnSupplier.Visible = true; } else if (GblIQCare.theArea == "CR") { theColumnSupplier.Visible = false; theColumnSourceStore.Visible = true; } // theColumnStatus.Visible=false; } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindow("#C1", theBuilder, this); return; } }
private void btnImport_Click(object sender, EventArgs e) { try { int iRes = 0; bool isUpdate = false, isVersionUpdate = false; if (txtFileName.Text.ToString() != "") { DataSet dsCollectDataToSave = new DataSet(); dsCollectDataToSave.ReadXml(txtFileName.Text.ToString()); IImportExportForms objImportFormDetails; objImportFormDetails = (IImportExportForms)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BImportExportForms,BusinessProcess.FormBuilder"); if (ddlFormType.Text.ToString() == "" || ddlFormType.SelectedItem.ToString() == "Forms") { string strVerName = ""; if (dsCollectDataToSave.Tables.Count < 11) { IQCareWindowMsgBox.ShowWindow("ImportFormsCheckVersion", this); return; } else if (dsCollectDataToSave.Tables.Count > 10) { strVerName = dsCollectDataToSave.Tables[10].Rows[0]["AppVer"].ToString(); if (GblIQCare.AppVersion.ToString() != strVerName) { IQCareWindowMsgBox.ShowWindow("ImportFormsCheckVersion", this); return; } } for (int i = 0; i < dsCollectDataToSave.Tables[0].Rows.Count; i++) { if (dsCollectDataToSave.Tables[0].Rows[i]["FeatureId"].ToString() == "126") { iRes = ImportExportDBUpdates(dsCollectDataToSave, false, false, objImportFormDetails); } else { DataSet DSExitingForm = objImportFormDetails.GetImportExportFormDetail(dsCollectDataToSave.Tables[0].Rows[i]["FeatureName"].ToString()); if (DSExitingForm.Tables[0].Rows.Count > 0) { if (!CheckFormVersion(dsCollectDataToSave, DSExitingForm)) { //mark true if same form found with no changes isUpdate = true; int result = DateTime.Compare(Convert.ToDateTime(DSExitingForm.Tables[15].Rows[0]["VersionDate"]), Convert.ToDateTime(dsCollectDataToSave.Tables[15].Rows[0]["VersionDate"])); if ((Convert.ToDecimal(dsCollectDataToSave.Tables[15].Rows[0]["VersionName"]) <= Convert.ToDecimal(DSExitingForm.Tables[15].Rows[0]["VersionName"])) && (result < 0)) { //mark isVersionUpdate = true form with changes found to update version info isVersionUpdate = true; isUpdate = false; DialogResult msgconfirm = IQCareWindowMsgBox.ShowWindow(string.Format("There are field changes on the form.{0} The electronic form version will update upon saving.", Environment.NewLine), "*", "", this); if (msgconfirm == DialogResult.OK) { iRes = ImportExportDBUpdates(dsCollectDataToSave, isUpdate, isVersionUpdate, objImportFormDetails); } else { return; } } else { if (isUpdate) { iRes = ImportExportDBUpdates(dsCollectDataToSave, isUpdate, isVersionUpdate, objImportFormDetails); } } } } else { iRes = ImportExportDBUpdates(dsCollectDataToSave, isUpdate, isVersionUpdate, objImportFormDetails); } } } } else { iRes = objImportFormDetails.ImportHomeForms(dsCollectDataToSave, GblIQCare.AppUserId, System.Convert.ToInt32(GblIQCare.AppCountryId)); } if (iRes == 1) { IQCareWindowMsgBox.ShowWindow("ImportSuccess", this); txtFileName.Text = ""; } } else { IQCareWindowMsgBox.ShowWindow("BrowseFile", this); txtFileName.Focus(); } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this); } }
private void dgwFormDetails_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (GblIQCare.HasFunctionRight(ApplicationAccess.PatientRegistration, FunctionAccess.Update, GblIQCare.dtUserRight) == true) { EnableControl(); if (e.RowIndex != -1) { strFormName = ""; strFormNameDb = dgwFormDetails.Rows[e.RowIndex].Cells[0].Value.ToString(); strFormName = strFormNameDb.Replace(" ", "_"); for (int i = 0; i < objDsFormDetails.Tables[0].Rows.Count; i++) { if (strFormNameDb == objDsFormDetails.Tables[0].Rows[i]["FormName"].ToString()) { GblIQCare.iFormBuilderId = Convert.ToInt32(objDsFormDetails.Tables[0].Rows[i]["FormId"]); strPublished = objDsFormDetails.Tables[0].Rows[i][3].ToString(); break; } } if (strPublished == "2") { DisableControl(); } else { EnableControl(); } if (e.ColumnIndex == -1) { iColIndex = 0; } else { iColIndex = e.ColumnIndex; } if (dgwFormDetails.Columns[iColIndex].HeaderText == "Published") { if (strPublished == "0" || strPublished == "1") { IManageForms objFormDetail; objFormDetail = (IManageForms)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BManageForms,BusinessProcess.FormBuilder"); DialogResult strResult; strResult = MessageBox.Show("Do you want to Published this form", "Yes/No", MessageBoxButtons.YesNo); if (strResult.ToString() == "Yes") { string strValue; strValue = "2"; int rowstate = objFormDetail.ResetFormStatus(GblIQCare.iFormBuilderId, strValue, GblIQCare.AppUserId); dgwFormDetails.DataSource = null; BindGrid(); } } else { IManageForms objFormDetail; objFormDetail = (IManageForms)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BManageForms,BusinessProcess.FormBuilder"); DialogResult strResult; strResult = MessageBox.Show("Do you want to unpublish this form?", "Yes/No", MessageBoxButtons.YesNo); if (strResult.ToString() == "Yes") { string strValue; strValue = "1"; int rowstate = objFormDetail.ResetFormStatus(GblIQCare.iFormBuilderId, strValue, GblIQCare.AppUserId); dgwFormDetails.DataSource = null; BindGrid(); EnableControl(); } } } } } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this); } }
private void mnuRefereshSystemCache_Click(object sender, EventArgs e) { #region Commented Old Code for GenerateCache //string strGetXMLPath = GblIQCare.GetXMLPath(); //System.IO.FileInfo theFileInfo1 = new System.IO.FileInfo(strGetXMLPath + "\\AllMasters.con"); //System.IO.FileInfo theFileInfo2 = new System.IO.FileInfo(strGetXMLPath + "\\DrugMasters.con"); //System.IO.FileInfo theFileInfo3 = new System.IO.FileInfo(strGetXMLPath + "\\LabMasters.con"); //theFileInfo1.Delete(); //theFileInfo2.Delete(); //theFileInfo3.Delete(); //IIQCareSystem theCacheManager = (IIQCareSystem)ObjectFactory.CreateInstance("BusinessProcess.Security.BIQCareSystem,BusinessProcess.Security"); //DataSet theMainDS = theCacheManager.GetSystemCache(); //DataSet WriteXMLDS = new DataSet(); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_CouncellingType"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_CouncellingTopic"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Provider"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Division"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Ward"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_District"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Reason"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Education"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Designation"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Employee"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Occupation"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Province"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Village"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Code"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_HIVAIDSCareTypes"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_ARTSponsor"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_HivDisease"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Assessment"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Symptom"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Decode"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Feature"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Function"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_HivDisclosure"].Copy()); ////WriteXMLDS.Tables.Add(theMainDS.Tables["mst_Satellite"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_LPTF"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["mst_StoppedReason"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["mst_facility"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_HIVCareStatus"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_RelationshipType"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_TBStatus"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_ARVStatus"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_LostFollowreason"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Regimen"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Store"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Supplier"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["mst_Donor"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Program"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Batch"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["VWDiseaseSymptom"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["mst_RegimenLine"].Copy()); //WriteXMLDS.WriteXml(strGetXMLPath + "\\AllMasters.con", XmlWriteMode.WriteSchema); //WriteXMLDS.Tables.Clear(); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Strength"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_FrequencyUnits"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Drug"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Generic"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_DrugType"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_Frequency"].Copy()); //WriteXMLDS.WriteXml(strGetXMLPath + "\\DrugMasters.con", XmlWriteMode.WriteSchema); //WriteXMLDS.Tables.Clear(); //WriteXMLDS.Tables.Add(theMainDS.Tables["Mst_LabTest"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Lnk_TestParameter"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Lnk_LabValue"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["Lnk_ParameterResult"].Copy()); //WriteXMLDS.Tables.Add(theMainDS.Tables["LabTestOrder"].Copy()); //WriteXMLDS.WriteXml(strGetXMLPath + "\\LabMasters.con", XmlWriteMode.WriteSchema); #endregion try { /* * Calling generate cache from common location * Update By: Gaurav * Update Date: 8 July 2014 */ IQCareUtils.GenerateCache(true); IQCareWindowMsgBox.ShowWindow("SysCacheRefresh", this); } catch (System.UnauthorizedAccessException uex) { IQCareWindowMsgBox.ShowWindow("Error - Access to the path is denied.", "", "", this); } catch (Exception ex) { IQCareWindowMsgBox.ShowWindow("Error - unable to refresh cache.", "", "", this); } }
private Boolean Validation_Form() { try { String AdjustmentDate = string.Format("{0:dd-MMM-yyyy}", dtpEffectiveDate.Text); if (Convert.ToInt32(ddlStoreName.SelectedValue) == 0) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Store Name"; IQCareWindowMsgBox.ShowWindow("BlankDropDown", theBuilder, this); return(false); } else if (Convert.ToInt32(ddlPreparedBy.SelectedValue) == 0) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Prepared By"; IQCareWindowMsgBox.ShowWindow("BlankDropDown", theBuilder, this); return(false); } else if (Convert.ToInt32(ddlAuthoriseBy.SelectedValue) == 0) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Authorised By"; IQCareWindowMsgBox.ShowWindow("BlankDropDown", theBuilder, this); return(false); } else if (Convert.ToDateTime(AdjustmentDate) > Convert.ToDateTime(GblIQCare.CurrentDate)) { IQCareWindowMsgBox.ShowWindow("AdjustmentStockDate", this); return(false); } DataTable thestockLevel = (DataTable)dgwStockLevelDetails.DataSource; bool IsAdjustreasonset = false; int AdjQtyCount = 0; for (int i = 0; i < thestockLevel.Rows.Count; i++) { if (!String.IsNullOrEmpty(Convert.ToString(thestockLevel.Rows[i]["AdjQty"]))) { if (Convert.ToInt32(thestockLevel.Rows[i]["AdjQty"]) == 0) { AdjQtyCount++; } } } if (thestockLevel.Rows.Count > 0) { if (thestockLevel.Rows.Count == AdjQtyCount) { IQCareWindowMsgBox.ShowWindow("AdjustStockLevel", this); return(false); } } for (int i = 0; i < thestockLevel.Rows.Count; i++) { if (thestockLevel.Rows[i]["AdjQty"].ToString() == "") { IQCareWindowMsgBox.ShowWindow("AdjustStockLevel", this); return(false); } } //AdjustReason for (int i = 0; i < thestockLevel.Rows.Count; i++) { if (!String.IsNullOrEmpty(Convert.ToString(thestockLevel.Rows[i]["AdjustReasonId"]))) { if (Convert.ToInt32(thestockLevel.Rows[i]["AdjustReasonId"]) > 0) { IsAdjustreasonset = true; break; } } } if (thestockLevel.Rows.Count > 0) { if (!IsAdjustreasonset) { IQCareWindowMsgBox.ShowWindow("AdjustmentReason", this); return(false); } } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this); } return(true); }
private bool ValidateForm() { DataView theDV = new DataView(theDTAllItems); if (ItemCode != txtItemCode.Text) { theDV.RowFilter = "DrugId = '" + txtItemCode.Text + "'"; if (theDV.ToTable().Rows.Count > 0) { IQCareWindowMsgBox.ShowWindow("CheckDuplicateValue", this); return(false); } } if (Convert.ToInt32(cmbDispensingUnit.SelectedValue) < 1) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Dispensing Unit"; IQCareWindowMsgBox.ShowWindowConfirm("BlankDropDown", theBuilder, this); return(false); } if (Convert.ToInt32(cmbPurchaseUnit.SelectedValue) < 1) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Purchase Unit"; IQCareWindowMsgBox.ShowWindowConfirm("BlankDropDown", theBuilder, this); return(false); } if (txtUnitQty.Text == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Purchase Unit Quantity"; IQCareWindowMsgBox.ShowWindowConfirm("BlankTextBox", theBuilder, this); return(false); } if (txtPurchaseUnitPrice.Text == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Purchase Unit Price"; IQCareWindowMsgBox.ShowWindowConfirm("BlankTextBox", theBuilder, this); return(false); } if (Convert.ToInt32(cmbManufacturer.SelectedValue) < 1) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Manufacturer"; IQCareWindowMsgBox.ShowWindowConfirm("BlankDropDown", theBuilder, this); return(false); } if (txtDispenseUnitPrice.Text == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Dispensing Unit Price"; IQCareWindowMsgBox.ShowWindowConfirm("BlankTextBox", theBuilder, this); return(false); } if (txtdespensingMargin.Text == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Dispensing Margin"; IQCareWindowMsgBox.ShowWindowConfirm("BlankTextBox", theBuilder, this); return(false); } if (txteditsellingprice.Text == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Selling price"; IQCareWindowMsgBox.ShowWindowConfirm("BlankTextBox", theBuilder, this); return(false); } return(true); }
private void btnSubmit_Click(object sender, EventArgs e) { if (Validation_Form() == true) { try { theDTStock = (DataTable)dgwOpeningStock.DataSource; DataTable dtb = theDTStock.Copy(); DataTable dtCheck = (DataTable)dgwOpeningStock.DataSource; DataView dt11 = dtCheck.DefaultView; theDTStock.PrimaryKey = new DataColumn[] { theDTStock.Columns["ItemId"], theDTStock.Columns["BatchId"], theDTStock.Columns["StoreId"], theDTStock.Columns["ExpiryDate"] }; DataView theDV = new DataView(theDTStock); DataTable dtNew = null; theDV.RowFilter = "ItemId=" + theItemIdGbl + " and BatchId=" + BatchId + " and StoreId=" + StoreId + " and ExpiryDate='" + ExpiryDate + "'"; if (theDV.Count > 0) { theDV.Delete(0); dtNew = dt11.ToTable(); if (dtNew.Rows.Count > 0) { for (int batchVal = 0; batchVal < dtNew.Rows.Count; batchVal++) { if (dtNew.Rows[batchVal]["BatchNo"].ToString() == txtBatchName.Text.ToString()) { ShowGrid(dtb); IQCareWindowMsgBox.ShowWindow("DuplicateBatchName", this); return; } } } DataRow theDRow = theDTStock.NewRow(); if (lstSearchBatch.SelectedValue == null) { BindFunctions theBindManager = new BindFunctions(); IMasterList objItemlist = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM"); DataSet theDSBatchName = objItemlist.SaveBatchName(txtBatchName.Text, GblIQCare.AppUserId, lstSearch.SelectedValue.ToString(), dtpExpiryDate.Text); theDRow["BatchId"] = Convert.ToString(theDSBatchName.Tables[0].Rows[0]["BatchId"]); theDTBatch.Clear(); theDTBatch = theDSBatchName.Tables[1]; theBindManager.Win_BindListBox(lstSearchBatch, theDTBatch, "Name", "Id"); } else { theDRow["BatchId"] = lstSearchBatch.SelectedValue; } theDRow["ItemId"] = lstSearch.SelectedValue; theDRow["ItemName"] = txtItemName.Text; theDRow["StoreId"] = ddlStore.SelectedValue; theDRow["StoreName"] = ddlStore.Text; theDRow["DispensingUnit"] = txtDispensingUnit.Text; theDRow["BatchNo"] = txtBatchName.Text; theDRow["ExpiryDate"] = string.Format("{0:dd-MMM-yyyy}", dtpExpiryDate.Text); theDRow["Quantity"] = txtOpeningQty.Text; theDRow["OpeningStock"] = 0; //theDRow["TransDate"] = string.Format("{0:dd-MMM-yyyy}", dtpExpiryDate.Text); theDTStock.Rows.Add(theDRow); } else { dtNew = dt11.ToTable(); if (dtNew.Rows.Count > 0) { for (int batchVal = 0; batchVal < dtNew.Rows.Count; batchVal++) { if (dtNew.Rows[batchVal]["BatchNo"].ToString() == txtBatchName.Text.ToString()) { ShowGrid(theDTStock); IQCareWindowMsgBox.ShowWindow("DuplicateBatchName", this); return; } } } DataRow theDRow = theDTStock.NewRow(); if (lstSearchBatch.SelectedValue == null) { BindFunctions theBindManager = new BindFunctions(); IMasterList objItemlist = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM"); //DataSet theDSBatchName = objItemlist.SaveBatchName(txtBatchName.Text, GblIQCare.AppUserId); DataSet theDSBatchName = objItemlist.SaveBatchName(txtBatchName.Text, GblIQCare.AppUserId, lstSearch.SelectedValue.ToString(), dtpExpiryDate.Text); theDRow["BatchId"] = Convert.ToString(theDSBatchName.Tables[0].Rows[0]["BatchId"]); theDTBatch.Clear(); theDTBatch = theDSBatchName.Tables[1]; theBindManager.Win_BindListBox(lstSearchBatch, theDTBatch, "Name", "Id"); } else { theDRow["BatchId"] = lstSearchBatch.SelectedValue; } theDRow["ItemId"] = lstSearch.SelectedValue; theDRow["ItemName"] = txtItemName.Text; theDRow["StoreId"] = ddlStore.SelectedValue; theDRow["StoreName"] = ddlStore.Text; theDRow["DispensingUnit"] = txtDispensingUnit.Text; theDRow["BatchNo"] = txtBatchName.Text; theDRow["ExpiryDate"] = string.Format("{0:dd-MMM-yyyy}", dtpExpiryDate.Text); theDRow["Quantity"] = txtOpeningQty.Text; theDRow["OpeningStock"] = 0; //theDRow["TransacDate"] = string.Format("{0:dd-MMM-yyyy}", dtpTransdate.Text); theDTStock.Rows.Add(theDRow); } theDTStock.AcceptChanges(); ShowGrid(theDTStock); Clear(); } catch (Exception err) { if (err.GetType().FullName == "System.Data.ConstraintException") { IQCareWindowMsgBox.ShowWindow("DuplicateItemName", this); } } } }
private void dgwFormDetails_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (e.ColumnIndex == -1) { return; } DialogResult strResult = DialogResult.None; IHomePageConfiguration objTechArea; MsgBuilder theBuilder = new MsgBuilder(); if (dgwFormDetails.Columns[e.ColumnIndex].HeaderText == "Published") { if (Convert.ToString(dgwFormDetails.Rows[e.RowIndex].Cells[4].Value) == "Published") { theBuilder.DataElements["PgStatus"] = "UnPublish"; } else { theBuilder.DataElements["PgStatus"] = "Publish"; } strResult = IQCareWindowMsgBox.ShowWindowConfirm("Publish", theBuilder, this); if (Convert.ToString(dgwFormDetails.Rows[e.RowIndex].Cells[4].Value) == "Published") { if (strResult == DialogResult.No) { return; } Hashtable theHT = new Hashtable(); theHT.Add("Status", "1"); theHT.Add("FeatureID", dgwFormDetails.Rows[e.RowIndex].Cells[5].Value); DataTable theDT = new DataTable(); objTechArea = (IHomePageConfiguration)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BHomePageConfiguration, BusinessProcess.FormBuilder"); Int32 intExistModuleId = objTechArea.StatusUpdate(theHT); BindGrid(); } else if (Convert.ToString(dgwFormDetails.Rows[e.RowIndex].Cells[4].Value) == "Un-Published") { if (strResult == DialogResult.No) { return; } Hashtable theHT = new Hashtable(); theHT.Add("Status", "2"); theHT.Add("FeatureID", dgwFormDetails.Rows[e.RowIndex].Cells[5].Value); DataTable theDT = new DataTable(); objTechArea = (IHomePageConfiguration)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BHomePageConfiguration, BusinessProcess.FormBuilder"); Int32 intExistModuleId = objTechArea.StatusUpdate(theHT); BindGrid(); } } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this); } }