Esempio n. 1
0
        private Boolean updateDashBoard(smrn smrn, int stat)
        {
            Boolean status = true;

            try
            {
                dashboardalarm dsb   = new dashboardalarm();
                DashboardDB    ddsDB = new DashboardDB();
                dsb.DocumentID    = smrn.DocumentID;
                dsb.TemporaryNo   = smrn.SMRNNo;
                dsb.TemporaryDate = smrn.SMRNDate;
                //dsb.DocumentNo = smrn.ProductionPlanNo;
                //dsb.DocumentDate = smrn.ProductionPlanDate;
                dsb.FromUser = Login.userLoggedIn;
                if (stat == 1)
                {
                    dsb.ActivityType = 2;
                    dsb.ToUser       = smrn.ForwardUser;
                    if (!ddsDB.insertDashboardAlarm(dsb))
                    {
                        MessageBox.Show("DashBoard Fail to update");
                        status = false;
                    }
                }
                else if (stat == 2)
                {
                    dsb.ActivityType = 3;
                    List <documentreceiver> docList = DocumentReceiverDB.getDocumentWiseReceiver(prevsh.DocumentID);
                    foreach (documentreceiver docRec in docList)
                    {
                        dsb.ToUser       = docRec.EmployeeID; //To store UserID Form DocumentReceiver for current Document
                        dsb.DocumentDate = UpdateTable.getSQLDateTime();
                        if (!ddsDB.insertDashboardAlarm(dsb))
                        {
                            MessageBox.Show("DashBoard Fail to update");
                            status = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                status = false;
            }
            return(status);
        }
Esempio n. 2
0
        //private void btnSave_Click(object sender, EventArgs e)
        //{

        //}

        private void grdList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex < 0)
                {
                    return;
                }
                string columnName = grdList.Columns[e.ColumnIndex].Name;
                if (columnName.Equals("Edit") || columnName.Equals("Approve") || columnName.Equals("View"))

                {
                    clearData();
                    setButtonVisibility(columnName);

                    prevsh = new smrn();
                    int rowID = e.RowIndex;
                    //prevpheader.ConversionDate = DateTime.Parse(grdList.Rows[e.RowIndex].Cells[0].Value.ToString());
                    try
                    {
                        prevsh.DocumentID   = grdList.Rows[e.RowIndex].Cells["DocumentID"].Value.ToString();
                        prevsh.DocumentName = grdList.Rows[e.RowIndex].Cells["DocumentName"].Value.ToString();
                        prevsh.SMRNNo       = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["SMRNNo"].Value.ToString());
                        prevsh.SMRNDate     = DateTime.Parse(grdList.Rows[e.RowIndex].Cells["SMRNDate"].Value.ToString());
                        prevsh.ForwardUser  = grdList.Rows[e.RowIndex].Cells["ForwardUser"].Value.ToString();

                        if (Login.userLoggedIn == prevsh.ForwardUser)
                        {
                            pnlInner.Enabled = false;
                            btnSave.Visible  = false;
                        }

                        prevsh.CustomerDocumentNo   = grdList.Rows[e.RowIndex].Cells["CustomerDocumentNo"].Value.ToString();
                        prevsh.CustomerDocumentDate = DateTime.Parse(grdList.Rows[e.RowIndex].Cells["CustomerDocumentDate"].Value.ToString());
                        prevsh.CustomerID           = grdList.Rows[e.RowIndex].Cells["CustomerID"].Value.ToString();
                        prevsh.CustomerName         = grdList.Rows[e.RowIndex].Cells["CustomerName"].Value.ToString();
                        prevsh.CourierID            = grdList.Rows[e.RowIndex].Cells["CourierID"].Value.ToString();
                        prevsh.CourierName          = grdList.Rows[e.RowIndex].Cells["CourierName"].Value.ToString();
                        prevsh.Remarks     = grdList.Rows[e.RowIndex].Cells["Remarks"].Value.ToString();
                        prevsh.NoOfPackets = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["NoOfPacket"].Value.ToString());
                        //prevsh.Status = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["Status"].Value.ToString());
                        //prevsh.DocumentStatus = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["DocStat"].Value.ToString());
                        prevsh.CreateTime  = DateTime.Parse(grdList.Rows[e.RowIndex].Cells["CreateTime"].Value.ToString());
                        prevsh.CreateUser  = grdList.Rows[e.RowIndex].Cells["CreateUser"].Value.ToString();
                        prevsh.ApproveUser = grdList.Rows[e.RowIndex].Cells["ApproveUser"].Value.ToString();

                        prevsh.ApproverName   = grdList.Rows[e.RowIndex].Cells["Approver"].Value.ToString();
                        prevsh.CreatorName    = grdList.Rows[e.RowIndex].Cells["Creator"].Value.ToString();
                        prevsh.ForwarderName  = grdList.Rows[e.RowIndex].Cells["Forwarder"].Value.ToString();
                        prevsh.ForwarderList  = grdList.Rows[e.RowIndex].Cells["Forwarders"].Value.ToString();
                        prevsh.DocumentStatus = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["DocumentStatus"].Value.ToString());
                        prevsh.Status         = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["Status"].Value.ToString());
                    }
                    catch (Exception ex)
                    {
                    }
                    btnSave.Text     = "Update";
                    pnlInner.Visible = true;
                    pnlOuter.Visible = true;
                    pnlList.Visible  = false;
                    //cmbStatus.Enabled = true;

                    txtSMRNNo.Text = prevsh.SMRNNo.ToString();
                    // DateTime ttmp = DateTime.Parse(grdList.Rows[e.RowIndex].Cells["TemporaryDate"].Value.ToString());

                    dtSMRNDate.Value      = prevsh.SMRNDate;
                    txtCuxtomerDocNo.Text = prevsh.CustomerDocumentNo;
                    try
                    {
                        dtCustomerDocDate.Value = prevsh.CustomerDocumentDate;
                    }
                    catch (Exception ex)
                    {
                        dtCustomerDocDate.Value = DateTime.Parse("01-01-1900");
                    }

                    //dtTrackingDate.Value = DateTime.Parse(grdList.Rows[e.RowIndex].Cells["TrackingDate"].Value.ToString());
                    ////////cmbCustomer.SelectedIndex = cmbCustomer.FindString(prevsh.CustomerID);
                    cmbCustomer.SelectedIndex =
                        Structures.ComboFUnctions.getComboIndex(cmbCustomer, prevsh.CustomerID);
                    ////////cmbCourierID.SelectedIndex = cmbCourierID.FindString(prevsh.CourierID);
                    cmbCourierID.SelectedIndex =
                        Structures.ComboFUnctions.getComboIndex(cmbCourierID, prevsh.CourierID);
                    txtNoOfPacket.Text = prevsh.NoOfPackets.ToString();
                    txtRemarks.Text    = prevsh.Remarks;
                }
            }
            catch (Exception ex)
            {
            }
        }
Esempio n. 3
0
        private void btnSave_Click_1(object sender, EventArgs e)
        {
            Boolean status = true;

            try
            {
                SMRNDB smrnhDB = new SMRNDB();
                smrn   smrnh   = new smrn();
                try
                {
                    ////////smrnh.CourierID = cmbCourierID.SelectedItem.ToString().Trim().Substring(0,cmbCourierID.SelectedItem.ToString().Trim().IndexOf('-'));
                    smrnh.CourierID = ((Structures.ComboBoxItem)cmbCourierID.SelectedItem).HiddenValue;
                    //////////smrnh.CustomerID = cmbCustomer.SelectedItem.ToString().Trim().Substring(0, cmbCustomer.SelectedItem.ToString().Trim().IndexOf('-'));
                    smrnh.CustomerID = ((Structures.ComboBoxItem)cmbCustomer.SelectedItem).HiddenValue;
                }
                catch (Exception)
                {
                    smrnh.CustomerID   = "";
                    smrnh.CustomerName = "";
                }
                smrnh.DocumentID = docID;

                smrnh.SMRNDate             = dtSMRNDate.Value;
                smrnh.CustomerDocumentDate = dtCustomerDocDate.Value;
                smrnh.Remarks            = txtRemarks.Text;
                smrnh.NoOfPackets        = Convert.ToInt32(txtNoOfPacket.Text);
                smrnh.CustomerDocumentNo = txtCuxtomerDocNo.Text;

                string btnText = btnSave.Text;
                if (btnText.Equals("Update"))
                {
                    smrnh.ForwarderList = prevsh.ForwarderList;
                    smrnh.SMRNNo        = Convert.ToInt32(txtSMRNNo.Text);
                    if (smrnhDB.validateSMRN(smrnh))
                    {
                        if (smrnhDB.updateSMRN(smrnh, prevsh))
                        {
                            MessageBox.Show("SMRN updated");
                            closeAllPanels();
                            listOption = 1;
                            ListFilteredSMRN(listOption);
                        }
                        else
                        {
                            status = false;
                            MessageBox.Show("Failed to update SMRN");
                        }
                    }
                    else
                    {
                        status = false;
                        MessageBox.Show("Smrn DEtail Entered Wrong");
                    }
                }
                else if (btnText.Equals("Save"))
                {
                    smrnh.DocumentStatus = 1;//created
                    smrnh.SMRNDate       = UpdateTable.getSQLDateTime();
                    smrnh.SMRNNo         = DocumentNumberDB.getNewNumber(docID, 1);
                    if (smrnhDB.validateSMRN(smrnh))
                    {
                        if (smrnhDB.insertSMRN(smrnh))
                        {
                            MessageBox.Show("SMRN Added");
                            closeAllPanels();
                            listOption = 1;
                            ListFilteredSMRN(listOption);
                        }
                        else
                        {
                            MessageBox.Show("Failed to Insert SMRN");
                            status = false;
                        }
                    }
                    else
                    {
                        status = false;
                        MessageBox.Show("Smrn DEtail Entered Wrong");
                    }
                }
                else
                {
                    status = false;
                    MessageBox.Show("SMRN Data Operation failed");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed Adding / Editing SMRN");
                status = false;
            }
            if (status)
            {
                setButtonVisibility("btnEditPanel"); //activites are same for cancel, forward,approve, reverse and save
            }
        }