예제 #1
0
        private void MakeTreeView(DataTable table, string salesregionCode, System.Windows.Forms.TreeNode PNode)
        {
            DataRow[] dr;
            string    now_salesregion_code;
            string    last_salesregion_code = "___";



            dr = table.Select("salesregion_code is not  null");

            System.Windows.Forms.TreeNode TNode = null;
            System.Windows.Forms.TreeNode CNode = null;

            foreach (DataRow d in dr)
            {
                now_salesregion_code = d["salesregion_name"].ToString();



                if (last_salesregion_code != now_salesregion_code)
                {
                    TNode = new System.Windows.Forms.TreeNode();

                    TNode.Text = d["salesregion_name"].ToString();

                    if (SQLDatabase.CheckHaveRight(SQLDatabase.NowUserID, "营业维修综合信息"))
                    {
                        TNode.Tag = "salesregion_code='" + d["salesregion_code"].ToString() + "'";
                    }
                    else if (SQLDatabase.CheckHaveRight(SQLDatabase.NowUserID, "营业维修部门信息"))
                    {
                        TNode.Tag = "salesregion_code='" + d["salesregion_code"].ToString() + "'";
                    }

                    else
                    {
                        TNode.Tag = "salesperson_code='" + SQLDatabase.NowUserID + "'";
                    }
                    if (PNode == null)
                    {
                        this.treeView1.Nodes.Add(TNode);
                    }
                    else
                    {
                        PNode.Nodes.Add(TNode);
                        CNode      = new System.Windows.Forms.TreeNode();
                        CNode.Text = d["yhmc"].ToString();
                        CNode.Tag  = "salesperson_code='" + d["yhbm"].ToString() + "'";
                        if (TNode == null)
                        {
                            this.treeView1.Nodes.Add(TNode);
                        }
                        else
                        {
                            TNode.Nodes.Add(CNode);
                        }
                    }
                }
                else
                {
                    CNode      = new System.Windows.Forms.TreeNode();
                    CNode.Text = d["yhmc"].ToString();
                    CNode.Tag  = "salesperson_code='" + d["yhbm"].ToString() + "'";
                    if (TNode == null)
                    {
                        this.treeView1.Nodes.Add(TNode);
                    }
                    else
                    {
                        TNode.Nodes.Add(CNode);
                    }
                }
                last_salesregion_code = now_salesregion_code;
            }
        }
        private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        {
            if (null == this.ly_production_orderDataGridView.CurrentRow)
            {
                return;
            }

            string            message = "增加质检记录吗?";
            string            caption = "提示...";
            MessageBoxButtons buttons = MessageBoxButtons.YesNo;

            DialogResult result;

            result = MessageBox.Show(message, caption, buttons,
                                     MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

            if (result == DialogResult.Yes)
            {
                decimal need_inspect_count;
                decimal send_inspect_count;



                if (!string.IsNullOrEmpty(this.ly_production_orderDataGridView.CurrentRow.Cells["加工数量"].Value.ToString()))
                {
                    need_inspect_count = decimal.Parse(this.ly_production_orderDataGridView.CurrentRow.Cells["加工数量"].Value.ToString());
                }
                else
                {
                    need_inspect_count = 0;
                }

                send_inspect_count = this.ly_production_task_inspectionDataGridView.RowCount;

                if (send_inspect_count >= need_inspect_count)
                {
                    MessageBox.Show("任务单装配数量已经全部送交,不能增加质检记录", "注意");

                    return;
                }
                else
                {
                    this.ly_restructuring_task_inspectionBindingSource.AddNew();

                    this.ly_production_task_inspectionDataGridView.CurrentRow.Cells["质检单号"].Value = GetMaxTaskInspection();

                    string nowproductionTaskNum = "";

                    nowproductionTaskNum = this.ly_production_orderDataGridView.CurrentRow.Cells["任务单号"].Value.ToString();

                    this.ly_production_task_inspectionDataGridView.CurrentRow.Cells["任务单号1"].Value = nowproductionTaskNum;

                    this.ly_production_task_inspectionDataGridView.CurrentRow.Cells["质检日期"].Value = SQLDatabase.GetNowdate().ToString();;

                    this.ly_production_task_inspectionDataGridView.CurrentRow.Cells["质检人"].Value = SQLDatabase.nowUserName();

                    this.ly_production_task_inspectionDataGridView.CurrentRow.Cells["质检次数"].Value = 1;

                    this.ly_production_task_inspectionDataGridView.CurrentRow.Cells["初检"].Value = "True";
                }
                SaveChanged();
            }
        }
        private void 全部合格设置ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (null == ly_production_task_inspectionDataGridView.CurrentRow)
            {
                return;
            }

            int j = 1;

            for (int i = 0; i < ly_production_task_inspectionDataGridView.RowCount; i++)
            {
                if (!string.IsNullOrEmpty(ly_production_task_inspectionDataGridView.Rows[i].Cells["设备编号"].Value.ToString()))
                {
                    if ("True" == ly_production_task_inspectionDataGridView.Rows[i].Cells["合格"].Value.ToString())
                    {
                        j = j + 1;
                    }
                    else
                    {
                        ly_production_task_inspectionDataGridView.Rows[i].Cells["合格"].Value   = "True";
                        ly_production_task_inspectionDataGridView.Rows[i].Cells["质检人"].Value  = SQLDatabase.nowUserName();
                        ly_production_task_inspectionDataGridView.Rows[i].Cells["质检日期"].Value = SQLDatabase.GetNowdate();
                        ly_production_task_inspectionDataGridView.Rows[i].Cells["质检单号"].Value = GetMaxTaskInspection();

                        if (!string.IsNullOrEmpty(ly_production_task_inspectionDataGridView.Rows[i].Cells["质检次数"].Value.ToString()))
                        {
                            ly_production_task_inspectionDataGridView.Rows[i].Cells["质检次数"].Value = int.Parse(ly_production_task_inspectionDataGridView.Rows[i].Cells["质检次数"].Value.ToString()) + 1;
                        }
                        else
                        {
                            ly_production_task_inspectionDataGridView.Rows[i].Cells["质检次数"].Value = 1;
                        }

                        this.ly_production_task_inspectionDataGridView.EndEdit();

                        this.Validate();
                        this.ly_restructuring_task_inspectionBindingSource.EndEdit();

                        this.ly_restructuring_task_inspectionTableAdapter.Update(this.lYProductMange.ly_restructuring_task_inspection);
                    }



                    j = j + 1;
                }
                else
                {
                    j = j + 1;
                }
            }
            SaveChanged();
        }
예제 #4
0
        private void ly_inma0010_sortDataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            DataGridView dgv = sender as DataGridView;

            if (null == dgv.CurrentRow)
            {
                return;
            }

            ////this.nowclientCode = ly_sales_businessDataGridView.CurrentRow.Cells["客户编码"].Value.ToString();
            ////this.nowcontractCode = ly_sales_businessDataGridView.CurrentRow.Cells["业务编码"].Value.ToString();

            //int now_id_main = int.Parse(dgv.CurrentRow.Cells["id_main"].Value.ToString());

            //string nowColumnName = dgv.CurrentCell.OwningColumn.Name;

            //this.ly_sales_contract_main_forbusinessTableAdapter.Fill(this.lYSalseMange.ly_sales_contract_main_forbusiness, this.nowcontractCode);

            //this.ly_sales_contract_main_forbusinessBindingSource.Position = this.ly_sales_contract_main_forbusinessBindingSource.Find("id", now_id_main);

            //dgv.CurrentCell = this.ly_sales_contract_mainDataGridView.CurrentRow.Cells[nowColumnName];

            ////}
            ////////////////////////////////////////////////////////////////////////////



            //if ("True" == dgv.CurrentRow.Cells["批准"].Value.ToString() && "000" != SQLDatabase.NowUserID)
            //{
            //    MessageBox.Show("合同已经执行,不能修改数据...", "注意");
            //    return;

            //}
            //////////////////////////////////////

            //采购员设置
            if (SQLDatabase.CheckHaveRight(SQLDatabase.NowUserID, "物料采购员设置"))
            {
                if ("采购员" == dgv.CurrentCell.OwningColumn.Name)
                {
                    //string sel = "SELECT distinct yhbm as 代码,yhmc as 名称 FROM T_users order by yhbm";

                    string sel = "select yhbm as 工号, yhmc as 姓名 from  T_users where bumen like '0004%'  and yhbm not  in ('916','931','009','903','905')";

                    QueryForm queryForm = new QueryForm();


                    queryForm.Sel    = sel;
                    queryForm.Constr = SQLDatabase.Connectstring;

                    //Set the Column Collection to the filter Table
                    //queryForm.SetSourceColumns(this.billMainDataSet.BalanceBill.Columns);

                    queryForm.ShowDialog();
                    dgv.CurrentRow.Cells["buyer_code"].Value = queryForm.Result;
                    dgv.CurrentRow.Cells["采购员"].Value        = queryForm.Result1;

                    this.ly_inma0010_sortBindingSource.EndEdit();

                    this.ly_inma0010_sortTableAdapter.Update(this.lYMaterielRequirements.ly_inma0010_sort);

                    //UpdateRequirement(itemno, nowid, "buyercode", queryForm.Result);
                }
            }

            //////////////////////////////////////

            //if ("种类存疑" == dgv.CurrentCell.OwningColumn.Name)
            //{

            //    if ("True" == dgv.CurrentRow.Cells["种类存疑"].Value.ToString())
            //    {
            //        dgv.CurrentRow.Cells["种类存疑"].Value = "False";

            //    }
            //    else
            //    {

            //        dgv.CurrentRow.Cells["种类存疑"].Value = "True";
            //    }



            //    this.ly_inma0010_sortBindingSource.EndEdit();

            //    this.ly_inma0010_sortTableAdapter.Update(this.lYMaterielRequirements.ly_inma0010_sort);



            //    return;

            //}

            /////////////////////////////////////
        }
예제 #5
0
 public ProductDAO()
 {
     _sqlDatabase = new SQLDatabase();
 }
예제 #6
0
        public void ProcessRequest(HttpContext context)
        {
            //Only run locally or in the network
            string ip = RequestVars.GetRequestIPv4Address();

            if (!ip.Equals("127.0.0.1") && !ip.StartsWith("172.16.") && !ip.StartsWith("192.168.0."))
            {
                ErrorHandler.WriteLog("GCC_Web_Portal.Jobs", "Job attempted to be run by invalid IP: " + ip, ErrorHandler.ErrorEventID.General);
                return;
            }
            //Get the job ID
            string jobID = RequestVars.Get("jobid", String.Empty);

            switch (jobID)
            {
            case "e07db58b-d3a6-4e01-a5ed-ff9875773b3c":

                #region Send weekly notification email

                DateTime startDate = DateTime.Now.Date.AddDays(-7);
                DateTime endDate   = DateTime.Now.Date.AddMilliseconds(-1);
                //DateTime startDate = new DateTime( 2015, 7, 1 ).Date;
                //DateTime endDate = new DateTime( 2015, 8, 1 ).Date.AddMilliseconds( -1 );
                SQLDatabase sql = new SQLDatabase();    sql.CommandTimeout = 120;
                DataTable   dt  = sql.ExecStoredProcedureDataTable("spJobs_StatusEmail",
                                                                   new SQLParamList()
                                                                   .Add("@DateCreated_Begin", startDate)
                                                                   .Add("@DateCreated_End", endDate));
                StringBuilder sbCurrent = new StringBuilder();
                sbCurrent.AppendFormat(@"<h3 style='margin:20px 0'>GEI / GSEI Dashboard for {0} to {1}</h3><table style='border-collapse:collapse;border:1px solid #444;width:100%' cellspacing='0' cellpadding='0'>", startDate.ToString("MMM d, yyyy"), endDate.ToString("MMM d, yyyy"));
                sbCurrent.AppendFormat("<thead><tr><th{0}></th><th{0}># Surveys</th><th{0}>GEI</th><th{0}>NPS</th><th{0}>PRS</th><th{0}>GSEI</th><th{0}># Followup</th><th{0}>% Followup</th><th{0}># <24h</th><th{0}>#24-48h</th><th{0}># > 48h</th><th{0}>Avg. Response</th></tr></thead>",
                                       " style='padding:5px;border:1px solid #BBB'");
                StringBuilder sbComparison = new StringBuilder("<h3 style='margin:20px 0'>Change from Previous Week</h3><table style='border-collapse:collapse;border:1px solid #444;width:100%' cellspacing='0' cellpadding='0'>");
                sbComparison.AppendFormat("<thead><tr><th{0}></th><th{0}># Surveys</th><th{0}>GEI</th><th{0}>NPS</th><th{0}>PRS</th><th{0}>GSEI</th><th{0}># Followup</th><th{0}>% Followup</th><th{0}># <24h</th><th{0}>#24-48h</th><th{0}># > 48h</th><th{0}>Avg. Response</th></tr></thead>",
                                          " style='padding:5px;border:1px solid #BBB'");
                Dictionary <string, List <string> > redFlagDetails = new Dictionary <string, List <string> >();
                foreach (DataRow dr in dt.Rows)
                {
                    sbCurrent.AppendFormat("<tr><th style='padding:5px;text-align:left;border:1px solid #BBB;'>{0}</th><td{12}>{1:#,###}</td><td{12}>{2}</td><td{12}>{3}</td><td{12}>{4}</td><td{12}>{5}</td><td{12}>{6:#,###}</td><td{12}>{7:#,###}</td><td{12}>{8:#,###}</td><td{12}>{9:#,###}</td><td{12}>{10:#,###}</td><td{12}>{11}</td></tr>",
                                           dr["ShortCode"],
                                           dr["TotalRecords"],
                                           ReportingTools.FormatIndex(dr["GEI"].ToString()),
                                           ReportingTools.FormatPercent(dr["NPS"].ToString()),
                                           ReportingTools.FormatPercent(dr["PRS"].ToString()),
                                           ReportingTools.FormatPercent(dr["GSEI"].ToString()),
                                           dr["FeedbackCount"], //6
                                           ReportingTools.FormatPercent(dr["FeedbackCompletePercent"].ToString()),
                                           dr["FeedbackLessThan24Hrs"],
                                           dr["Feedback24HrsTo48Hrs"],
                                           dr["FeedbackGreaterThan48Hrs"],
                                           ReportingTools.MinutesToNiceTime(dr["AverageFeedbackResponse"].ToString()),
                                           " style='padding:5px;border:1px solid #BBB;text-align:center'"
                                           );
                    sbComparison.AppendFormat("<tr><th style='padding:5px;text-align:left;border:1px solid #BBB;'>{0}</th>{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}</tr>",
                                              dr["ShortCode"],
                                              GetChangeCell(dr, "TotalRecords_Diff", String.Format("{0:#,###}", dr["TotalRecords"]), redFlagDetails, null),
                                              GetChangeCell(dr, "GEI_Diff", ReportingTools.FormatIndex(dr["GEI_Diff"].ToString()), redFlagDetails, r => { return(r != -1000 && r <= -10); }),
                                              GetChangeCell(dr, "NPS_Diff", ReportingTools.FormatPercent(dr["NPS_Diff"].ToString()), redFlagDetails, r => { return(r != -1000 && r <= -0.1); }),
                                              GetChangeCell(dr, "PRS_Diff", ReportingTools.FormatPercent(dr["PRS_Diff"].ToString()), redFlagDetails, r => { return(r != -1000 && r <= -0.1); }),
                                              GetChangeCell(dr, "GSEI_Diff", ReportingTools.FormatPercent(dr["GSEI_Diff"].ToString()), redFlagDetails, r => { return(r != -1000 && r <= -0.1); }),
                                              GetChangeCell(dr, "FeedbackCount_Diff", String.Format("{0:#,###}", dr["FeedbackCount_Diff"]), redFlagDetails, null), //6
                                              GetChangeCell(dr, "FeedbackCompletePercent_Diff", ReportingTools.FormatPercent(dr["FeedbackCompletePercent_Diff"].ToString()), redFlagDetails, r => { return(r != -1000 && r <= -0.1); }),
                                              GetChangeCell(dr, "FeedbackLessThan24Hrs_Diff", String.Format("{0:#,###}", dr["FeedbackLessThan24Hrs_Diff"]), redFlagDetails, null),
                                              GetChangeCell(dr, "Feedback24HrsTo48Hrs_Diff", String.Format("{0:#,###}", dr["Feedback24HrsTo48Hrs_Diff"]), redFlagDetails, null),
                                              GetChangeCell(dr, "FeedbackGreaterThan48Hrs_Diff", String.Format("{0:#,###}", dr["FeedbackGreaterThan48Hrs_Diff"]), redFlagDetails, null),
                                              GetChangeCell(dr, "AverageFeedbackResponse_Diff", ReportingTools.MinutesToNiceTime(dr["AverageFeedbackResponse_Diff"].ToString()), redFlagDetails, r => { return(r != -1000 && r >= 120); })
                                              );
                }
                sbCurrent.Append("</table><br /><br /><br />");
                sbComparison.Append("</table>");

                StringBuilder sbRedFlags = new StringBuilder();
                foreach (var kvp in redFlagDetails)
                {
                    if (sbRedFlags.Length == 0)
                    {
                        sbRedFlags.Append("<h3 style='margin:20px 0'>Red Flag Summary</h3><ul>");
                    }
                    if (kvp.Key.Length <= 4)
                    {
                        //Score
                        sbRedFlags.AppendFormat("<li><b>{0} score</b> has decreased by at least 10% for the following site(s): ", kvp.Key);
                    }
                    else if (kvp.Key.Equals("FeedbackCompletePercent"))
                    {
                        //Completion percentage
                        sbRedFlags.Append("<li><b>Feedback Completion</b> has decreased by at least 10% for the following site(s): ");
                    }
                    else if (kvp.Key.Equals("AverageFeedbackResponse"))
                    {
                        //Feedback response
                        sbRedFlags.Append("<li><b>Average Feedback Response</b> has increased by at least 2 hours for the following site(s): ");
                    }
                    foreach (string shortCode in kvp.Value)
                    {
                        sbRedFlags.AppendFormat("{0}, ", shortCode);
                    }
                    sbRedFlags.Remove(sbRedFlags.Length - 2, 2)
                    .Append("</li>");
                }
                if (sbRedFlags.Length > 0)
                {
                    sbRedFlags.Append("</ul><br />");
                    sbCurrent.Insert(0, sbRedFlags.ToString());
                }

                MailMessage msg = null;
                try
                {
                    var replacementModel = new
                    {
                        DataTables = sbCurrent.ToString() + sbComparison.ToString()
                    };
                    string path = context.Server.MapPath("~/Content/notifications/");
                    msg = EmailManager.CreateEmailFromTemplate(
                        Path.Combine(path, "WeeklyNotification.htm"),
                        replacementModel);
                    msg.IsBodyHtml   = true;
                    msg.BodyEncoding = System.Text.Encoding.UTF8;
                    msg.From         = new MailAddress("*****@*****.**");
                    msg.Subject      = "GCGC Weekly Status Notification - Week Ending " + endDate.ToString("MMM d, yyyy");
                    bool hasAddress = false;

                    dt = sql.QueryDataTable(@"
SELECT [SendType], u.[FirstName], u.[LastName],  u.[Email]
FROM [tblNotificationUsers] ne
	INNER JOIN [tblNotificationPropertySurveyReason] psr
		ON ne.[PropertySurveyReasonID] = psr.[PropertySurveyReasonID]
	INNER JOIN [tblCOM_Users] u
		ON ne.UserID = u.UserID
WHERE psr.PropertyID = @PropertyID
    AND psr.SurveyTypeID = @SurveyID
    AND psr.ReasonID = @ReasonID
;",
                                            new SQLParamList()
                                            .Add("@PropertyID", (int)GCCPropertyShortCode.GCC)
                                            .Add("@SurveyID", (int)SurveyType.GEI)
                                            .Add("@ReasonID", (int)NotificationReason.WeeklyStatusNotification)
                                            );
                    if (!sql.HasError && dt.Rows.Count > 0)
                    {
                        StringBuilder addrs = new StringBuilder();
                        foreach (DataRow dr in dt.Rows)
                        {
                            switch (dr["SendType"].ToString())
                            {
                            case "1":
                                msg.To.Add(dr["Email"].ToString());
                                addrs.Append(dr["FirstName"].ToString() + " " + dr["LastName"].ToString() + " <" + dr["Email"].ToString() + ">" + "\n");
                                hasAddress = true;
                                break;

                            case "2":
                                msg.CC.Add(dr["Email"].ToString());
                                //Colin requested that CC addresses not show on the call Aug 10,2015
                                //addrs.Append( dr["FirstName"].ToString() + " " + dr["LastName"].ToString() + " <" + dr["Email"].ToString() + ">" + "\n" );
                                hasAddress = true;
                                break;

                            case "3":
                                msg.Bcc.Add(dr["Email"].ToString());
                                hasAddress = true;
                                break;
                            }
                        }
                        //using ( StreamReader sr = new StreamReader( msg.AlternateViews[0].ContentStream ) ) {
                        //    msg.AlternateViews[0] = AlternateView.CreateAlternateViewFromString( sr.ReadToEnd().Replace( "{Recipients}", context.Server.HtmlEncode( addrs.ToString() ).Replace( "\n", "<br />" ) ), null, MediaTypeNames.Text.Html );
                        //}
                    }

                    if (hasAddress)
                    {
                        msg.Send();
                    }
                }
                catch (Exception ex)
                {
                    ErrorHandler.WriteLog("GCC_Web_Portal.Jobs", "Error running job.", ErrorHandler.ErrorEventID.General, ex);
                }
                finally
                {
                    if (msg != null)
                    {
                        msg.Dispose();
                        msg = null;
                    }
                }
                return;

                #endregion Send weekly notification email

            case "506aebb3-dfa2-4b34-94bc-51e81f5f31d3":

                #region Send Feedback Reminder Email

                sql = new SQLDatabase();
                dt  = sql.ExecStoredProcedureDataTable("[spJobs_48HrReminder]");
                foreach (DataRow dr in dt.Rows)
                {
                    GCCPropertyShortCode sc;
                    SurveyType           st;
                    NotificationReason   nr;
                    DateTime             created = Conversion.XMLDateToDateTime(dr["DateCreated"].ToString());
                    string feedbackUID           = dr["UID"].ToString();
                    if (Enum.TryParse(dr["PropertyID"].ToString(), out sc) &&
                        Enum.TryParse(dr["SurveyTypeID"].ToString(), out st) &&
                        Enum.TryParse(dr["ReasonID"].ToString(), out nr))
                    {
                        switch (st)
                        {
                        case SurveyType.GEI:
                            string gagLocation = dr["GEIGAGLocation"].ToString();
                            if (gagLocation.Length > 0)
                            {
                                gagLocation = " - " + gagLocation;
                            }
                            string fbLink = GCCPortalUrl + "Admin/Feedback/" + feedbackUID;
                            SurveyTools.SendNotifications(HttpContext.Current.Server, sc, st, nr, string.Empty,
                                                          new
                            {
                                Date               = created.ToString("yyyy-MM-dd"),
                                CasinoName         = PropertyTools.GetCasinoName((int)sc) + gagLocation,
                                Problems           = (dr["Q27"].Equals(1) ? "Yes" : "No"),
                                Response           = (dr["Q40"].Equals(1) ? "Yes" : "No"),
                                ProblemDescription = dr["Q27B"].ToString(),
                                StaffComment       = dr["Q11"].ToString(),
                                GeneralComments    = dr["Q34"].ToString(),
                                MemorableEmployee  = dr["Q35"].ToString(),
                                FeedbackLinkTXT    = (String.IsNullOrWhiteSpace(feedbackUID) ? String.Empty : "\n\nRespond to this feedback:\n" + fbLink + "\n"),
                                FeedbackLinkHTML   = (String.IsNullOrWhiteSpace(feedbackUID) ? String.Empty : @"<br /><br />
	<p><b>Respond to this feedback:</b></p>
	<p>"     + fbLink + "</p>"),
                                SurveyLink = GCCPortalUrl + "Display/GEI/" + dr["RecordID"].ToString()
                            },
                                                          String.Empty,
                                                          "Overdue: ");
                            break;

                        case SurveyType.Hotel:
                            SurveyTools.SendNotifications(HttpContext.Current.Server, sc, st, nr, string.Empty,
                                                          new
                            {
                                CasinoName       = PropertyTools.GetCasinoName((int)sc),
                                FeedbackNoteHTML = "<p><b>This guest has requested a response.</b> You can view and respond to the feedback request by clicking on (or copying and pasting) the following link:</p>\n<p>" + GCCPortalUrl + "Admin/Feedback/" + feedbackUID + "</p>",
                                FeedbackNoteTXT  = "The guest requested feedback. You can view and respond to the feedback request by clicking on (or copying and pasting) the following link:\n" + GCCPortalUrl + "Admin/Feedback/" + feedbackUID + "\n\n",
                                SurveyLink       = GCCPortalUrl + "Display/Hotel/" + dr["RecordID"].ToString()
                            },
                                                          String.Empty,
                                                          "Overdue: ");
                            break;

                        case SurveyType.Feedback:
                            gagLocation = dr["FBKGAGLocation"].ToString();
                            if (gagLocation.Length > 0)
                            {
                                gagLocation = " - " + gagLocation;
                            }
                            SurveyTools.SendNotifications(HttpContext.Current.Server, sc, st, nr, string.Empty,
                                                          new
                            {
                                Date             = created.ToString("yyyy-MM-dd"),
                                CasinoName       = PropertyTools.GetCasinoName((int)sc) + gagLocation,
                                FeedbackNoteHTML = "<p><b>This guest has requested a response.</b> You can view and respond to the feedback request by clicking on (or copying and pasting) the following link:</p>\n<p>" + GCCPortalUrl + "Admin/Feedback/" + feedbackUID + "</p>",
                                FeedbackNoteTXT  = "The guest requested feedback. You can view and respond to the feedback request by clicking on (or copying and pasting) the following link:\n" + GCCPortalUrl + "Admin/Feedback/" + feedbackUID + "\n\n",
                                SurveyLink       = GCCPortalUrl + "Display/Feedback/" + dr["RecordID"].ToString()
                            },
                                                          String.Empty,
                                                          "Overdue: ");
                            break;

                        case SurveyType.Donation:
                            SurveyTools.SendNotifications(HttpContext.Current.Server, sc, st, nr, string.Empty,
                                                          new
                            {
                                Date         = created.ToString("yyyy-MM-dd"),
                                CasinoName   = PropertyTools.GetCasinoName((int)sc),
                                FeedbackLink = GCCPortalUrl + "Admin/Feedback/" + feedbackUID,
                                Link         = GCCPortalUrl + "Display/Donation/" + dr["RecordID"].ToString()
                            },
                                                          String.Empty,
                                                          "Overdue: ");
                            break;
                        }
                    }
                }
                return;

                #endregion Send Feedback Reminder Email
            }

            context.Response.ContentType = "text/plain";
            context.Response.Write("Invalid Job ID.");
        }
예제 #7
0
        private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        {
            string            message = "增加物料计划吗?";
            string            caption = "提示...";
            MessageBoxButtons buttons = MessageBoxButtons.YesNo;

            DialogResult result;



            result = MessageBox.Show(message, caption, buttons,
                                     MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

            if (result == DialogResult.Yes)
            {
                this.ly_material_plan_mainBindingSource.AddNew();
                this.ly_material_plan_mainDataGridView.CurrentRow.Cells["计划编号"].Value = GetMaxPlanCode();
                this.ly_material_plan_mainDataGridView.CurrentRow.Cells["制定日期"].Value = DateTime.Now;
                this.ly_material_plan_mainDataGridView.CurrentRow.Cells["制定人"].Value  = SQLDatabase.nowUserName();
                this.ly_material_plan_mainBindingSource.EndEdit();

                this.Validate();
                this.ly_material_plan_mainBindingSource.EndEdit();



                this.ly_material_plan_mainTableAdapter.Update(this.lYPlanMange.ly_material_plan_main);



                SetFormState("Edit");
                this.制定日期DateTimePicker.Focus();

                //DataRowView nowCard = (DataRowView)this.yX_clientBindingSource.Current;

                //   nowCard["Card_number"].; nowCard.
            }
        }
예제 #8
0
        private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        {
            //if (CheckFinished()) return;

            //if (null == this.ly_production_order_materialrequisitionDataGridView.CurrentRow) return;



            //string nowmaterialrequisitionnum = this.ly_production_order_materialrequisitionDataGridView.CurrentRow.Cells["领料单号5"].Value.ToString();

            // if ("下料" == nowordername) return;  ly_machinepart_process_workDataGridView

            string            message = "增加外协生产领料记录吗?";
            string            caption = "提示...";
            MessageBoxButtons buttons = MessageBoxButtons.YesNo;

            DialogResult result;



            result = MessageBox.Show(message, caption, buttons,
                                     MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

            if (result == DialogResult.Yes)
            {
                decimal request_count;
                decimal hadget_count;



                //if (!string.IsNullOrEmpty(this.ly_production_order_materialrequisitionDataGridView.CurrentRow.Cells["数量5"].Value.ToString()))
                //{
                //    request_count = decimal.Parse(this.ly_production_order_materialrequisitionDataGridView.CurrentRow.Cells["数量5"].Value.ToString());
                //}
                //else
                //{
                //    request_count = 0;
                //}


                //if (!string.IsNullOrEmpty(this.ly_production_order_inspectionAll_InstoreDataGridView.CurrentRow.Cells["入库数量0"].Value.ToString()))
                //{
                //    instore_count = decimal.Parse(this.ly_production_order_inspectionAll_InstoreDataGridView.CurrentRow.Cells["入库数量0"].Value.ToString());
                //}
                //else
                //{
                //    instore_count = 0;
                //}


                hadget_count = 0;

                if (null != this.ly_store_outDataGridView.CurrentRow)
                {
                    foreach (DataGridViewRow dgr in ly_store_outDataGridView.Rows)
                    {
                        if (string.IsNullOrEmpty(dgr.Cells["领料数量"].Value.ToString()))
                        {
                            continue;
                        }
                        hadget_count = hadget_count + decimal.Parse(dgr.Cells["领料数量"].Value.ToString());
                    }
                }



                //if (hadget_count >= request_count)
                //{

                //    MessageBox.Show("该领料单数量已全部领完,不能增加领料出库记录", "注意");

                //    return;
                //}


                else
                {
                    this.ly_store_out_JGBindingSource.AddNew();

                    //this.ly_store_outDataGridView.CurrentRow.Cells["领料单号"].Value = this.ly_production_order_materialrequisitionDataGridView.CurrentRow.Cells["领料单号5"].Value;
                    //this.ly_store_outDataGridView.CurrentRow.Cells["出库单号"].Value = GetMaxStoreOutnum();

                    //this.ly_store_outDataGridView.CurrentRow.Cells["物料编号"].Value = this.ly_production_order_materialrequisitionDataGridView.CurrentRow.Cells["物料编号5"].Value;


                    //this.ly_store_outDataGridView.CurrentRow.Cells["领料数量"].Value = request_count - hadget_count;
                    //this.ly_store_outDataGridView.CurrentRow.Cells["领料人"].Value = this.ly_production_order_materialrequisitionDataGridView.CurrentRow.Cells["姓名5"].Value;


                    this.ly_store_outDataGridView.CurrentRow.Cells["出库日期"].Value = SQLDatabase.GetNowdate().ToString();;

                    this.ly_store_outDataGridView.CurrentRow.Cells["发料人"].Value = SQLDatabase.nowUserName();


                    this.ly_store_outDataGridView.CurrentRow.Cells["出库类别"].Value = "外协生产";
                }



                SaveChanged();



                //this.ly_store_outTableAdapter.Fill(this.lYStoreMange.ly_store_out, nowOutNum);
                //this.ly_store_outBindingSource.Position = this.ly_store_outBindingSource.Find("物料编号", componentNum);
            }
        }
예제 #9
0
        private void ly_store_outDataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            DataGridView dgv = sender as DataGridView;

            if ("True" == this.ly_store_outDataGridView.CurrentRow.Cells["签证"].Value.ToString())
            {
                MessageBox.Show("已经签证,不能修改(实需删除,请先删除签证标记)", "注意");
                return;
            }



            string nowoperptar = this.ly_store_outDataGridView.CurrentRow.Cells["发料人"].Value.ToString();

            if (nowoperptar != SQLDatabase.nowUserName())
            {
                MessageBox.Show("请发料人:" + nowoperptar + "修改", "注意");
                return;
            }



            if ("领料数量" == dgv.CurrentCell.OwningColumn.Name)
            {
                ChangeValue queryForm = new ChangeValue();

                queryForm.OldValue   = dgv.CurrentCell.Value.ToString();
                queryForm.NewValue   = "";
                queryForm.ChangeMode = "value";
                queryForm.ShowDialog();

                decimal oldnum      = decimal.Parse(dgv.CurrentCell.Value.ToString());
                decimal storenum    = decimal.Parse(dgv.CurrentRow.Cells["storecount"].Value.ToString());
                decimal stanterdnum = 0;

                if (null != this.ly_outsource_order_materialrequisitionDataGridView.CurrentRow)
                {
                    stanterdnum = decimal.Parse(this.ly_outsource_order_materialrequisitionDataGridView.CurrentRow.Cells["未领数量1"].Value.ToString());
                }

                if (queryForm.NewValue != "")
                {
                    decimal newnum = decimal.Parse(queryForm.NewValue);


                    if ((newnum - oldnum) > storenum)
                    {
                        MessageBox.Show("库存不足,操作取消...");
                    }
                    else if (newnum - oldnum > stanterdnum)
                    {
                        MessageBox.Show("领料超计划,操作取消...");
                    }
                    else
                    {
                        dgv.CurrentRow.Cells["领料数量"].Value = queryForm.NewValue;
                        //dgv.CurrentRow.Cells["discount_money"].Value = DBNull.Value;

                        //dgv.CurrentRow.Cells["approve_flag"].Value = "False";
                        SaveChanged();
                    }


                    // CountPlanStru();
                }
                else
                {
                    //hT_Manage_ItemDataGridView.CurrentRow.Cells["apply_money"].Value = queryForm.NewValue;
                    //dgv.CurrentRow.Cells["discount_money"].Value = DBNull.Value;
                    //dgv.CurrentRow.Cells["apply_money"].Value = DBNull.Value;
                    //dgv.CurrentRow.Cells["approve_flag"].Value = "False";
                    //SaveChanged();
                }
                return;
            }


            /////////////////////////////////////////////////////



            //if ("部门名称" == dgv.CurrentCell.OwningColumn.Name)
            //{

            //    return;
            //    //ChangeValue queryForm = new ChangeValue();

            //    //queryForm.OldValue = dgv.CurrentCell.Value.ToString();
            //    //queryForm.NewValue = "";
            //    //queryForm.ShowDialog();



            //    //if (queryForm.NewValue != "")
            //    //{
            //    //    dgv.CurrentRow.Cells["部门名称"].Value = queryForm.NewValue;
            //    //    //dgv.CurrentRow.Cells["discount_money"].Value = DBNull.Value;

            //    //    //dgv.CurrentRow.Cells["approve_flag"].Value = "False";
            //    //    SaveChanged();

            //    //}
            //    //else
            //    //{


            //    //}
            //    //return;

            //    //////////////////

            //    string sel = "SELECT a.prodname as 编码,a.prodcode as 名称 FROM ly_prod_dept a ";


            //    QueryForm queryForm = new QueryForm();


            //    queryForm.Sel = sel;
            //    queryForm.Constr = SQLDatabase.Connectstring;



            //    queryForm.ShowDialog();



            //    dgv.CurrentRow.Cells["部门名称"].Value = queryForm.Result; ;
            //    SaveChanged();



            //    return;
            //}



            ///////////////////////////////////////////////////////////////here....

            //if (CheckFinished()) return;

            //if ("True" == this.ly_store_outDataGridView.CurrentRow.Cells["签证"].Value.ToString())
            //{
            //    MessageBox.Show("已经签证,不能修改(实需删除,请先删除签证标记)", "注意");
            //    return;

            //}

            //string nowoperptar = this.ly_store_outDataGridView.CurrentRow.Cells["发料人"].Value.ToString();

            //if (nowoperptar != SQLDatabase.nowUserName())
            //{
            //    MessageBox.Show("请发料人:" + nowoperptar + "修改", "注意");
            //    return;
            //}

            //DataGridView dgv = sender as DataGridView;



            //if ("领料数量" == dgv.CurrentCell.OwningColumn.Name)
            //{

            //    ChangeValue queryForm = new ChangeValue();

            //    queryForm.OldValue = dgv.CurrentCell.Value.ToString();
            //    queryForm.NewValue = "";
            //    queryForm.ChangeMode = "value";
            //    queryForm.ShowDialog();



            //    if (queryForm.NewValue != "")
            //    {
            //        dgv.CurrentRow.Cells["领料数量"].Value = queryForm.NewValue;

            //        /////////////////////////////////////////////////////////////////////////////////////////////
            //        decimal request_count;
            //        decimal hadget_count;



            //        //if (!string.IsNullOrEmpty(this.ly_production_order_materialrequisitionDataGridView.CurrentRow.Cells["数量5"].Value.ToString()))
            //        //{
            //        //    request_count = decimal.Parse(this.ly_production_order_materialrequisitionDataGridView.CurrentRow.Cells["数量5"].Value.ToString());
            //        //}
            //        //else
            //        //{
            //        //    request_count = 0;
            //        //}


            //        //if (!string.IsNullOrEmpty(this.ly_production_order_inspectionAll_InstoreDataGridView.CurrentRow.Cells["入库数量0"].Value.ToString()))
            //        //{
            //        //    instore_count = decimal.Parse(this.ly_production_order_inspectionAll_InstoreDataGridView.CurrentRow.Cells["入库数量0"].Value.ToString());
            //        //}
            //        //else
            //        //{
            //        //    instore_count = 0;
            //        //}


            ////        hadget_count = 0;

            ////        if (null != this.ly_store_outDataGridView.CurrentRow)
            ////        {

            ////            foreach (DataGridViewRow dgr in ly_store_outDataGridView.Rows)
            ////            {

            ////                if (string.IsNullOrEmpty(dgr.Cells["领料数量"].Value.ToString())) continue;
            ////                hadget_count = hadget_count + decimal.Parse(dgr.Cells["领料数量"].Value.ToString());



            ////            }
            ////        }



            //        //if (hadget_count >= request_count)
            //        //{

            //        //    MessageBox.Show("该领料单数量已全部领完,不能增加领料出库记录", "注意");

            //        //    if (string.IsNullOrEmpty(queryForm.OldValue))
            //        //    {
            //        //        dgv.CurrentRow.Cells["领料数量"].Value = DBNull.Value;
            //        //    }
            //        //    else
            //        //    {
            ////        //        dgv.CurrentRow.Cells["领料数量"].Value = queryForm.OldValue;
            ////        //    }

            ////        //    return;
            ////        //}



            ////        SaveChanged();


            ////        //CountPlanStru();

            ////    }
            ////    else
            ////    {
            ////        //hT_Manage_ItemDataGridView.CurrentRow.Cells["apply_money"].Value = queryForm.NewValue;
            ////        //dgv.CurrentRow.Cells["discount_money"].Value = DBNull.Value;
            ////        //dgv.CurrentRow.Cells["apply_money"].Value = DBNull.Value;
            ////        //dgv.CurrentRow.Cells["approve_flag"].Value = "False";
            ////        //SaveChanged();

            ////    }
            //    return;

            //}



            /////////////////////////////////////////////////////////////////////////////////


            //if ("出库日期" == dgv.CurrentCell.OwningColumn.Name)
            //{

            //    ChangeValue queryForm = new ChangeValue();

            //    queryForm.OldValue = dgv.CurrentCell.Value.ToString();
            //    queryForm.NewValue = "";
            //    queryForm.ChangeMode = "datetime";
            //    queryForm.ShowDialog();



            //    if (queryForm.NewValue != "")
            //    {
            //        dgv.CurrentRow.Cells["出库日期"].Value = queryForm.NewValue;
            //        //dgv.CurrentRow.Cells["discount_money"].Value = DBNull.Value;

            //        //dgv.CurrentRow.Cells["approve_flag"].Value = "False";
            //        SaveChanged();


            //        //CountPlanStru();

            //    }
            //    else
            //    {


            //    }
            //    return;


            //    /////////////////////////////////////

            //    //DatePicker queryForm = new DatePicker();
            //    //queryForm.Pt = pt;

            //    //if (null != (dgv.CurrentCell.Value))
            //    //    queryForm.NowDate = dgv.CurrentCell.Value.ToString();

            //    //queryForm.ShowDialog();



            //    //if (null != queryForm.NowDate)
            //    //{

            //    //    dgv.CurrentRow.Cells["检验日期"].Value = queryForm.NowDate;
            //    //    SaveChanged();

            //    //}
            //    //return;
            //}



            /////////////////////////////////////////////////////////

            //if ("备注" == dgv.CurrentCell.OwningColumn.Name)
            //{

            //    ChangeValue queryForm = new ChangeValue();

            //    queryForm.OldValue = dgv.CurrentCell.Value.ToString();
            //    queryForm.NewValue = "";
            //    queryForm.ChangeMode = "longstring";
            //    queryForm.ShowDialog();



            //    if (queryForm.NewValue != "")
            //    {
            //        dgv.CurrentRow.Cells["备注"].Value = queryForm.NewValue;
            //        //dgv.CurrentRow.Cells["discount_money"].Value = DBNull.Value;

            //        //dgv.CurrentRow.Cells["approve_flag"].Value = "False";
            //        SaveChanged();


            //        //CountPlanStru();

            //    }
            //    else
            //    {

            //    }
            //    return;

            //}

            //////////////////////////////////

            ///////////////////////////////////////////////////////

            //if ("送交人" == dgv.CurrentCell.OwningColumn.Name)
            //{



            //    string sel;



            //    sel = "SELECT   yhmc as 姓名 FROM T_users where bumen='000401'";



            //    QueryForm queryForm = new QueryForm();


            //    queryForm.Sel = sel;
            //    queryForm.Constr = SQLDatabase.Connectstring;

            //    //Set the Column Collection to the filter Table
            //    //queryForm.SetSourceColumns(this.billMainDataSet.BalanceBill.Columns);

            //    queryForm.ShowDialog();


            //    if (queryForm.Result != "")
            //    {
            //        dgv.CurrentRow.Cells["送交人"].Value = queryForm.Result;
            //        //dgv.CurrentRow.Cells["discount_money"].Value = DBNull.Value;

            //        //dgv.CurrentRow.Cells["approve_flag"].Value = "False";
            //        SaveChanged();


            //        //CountPlanStru();

            //    }
            //    else
            //    {
            //        //hT_Manage_ItemDataGridView.CurrentRow.Cells["apply_money"].Value = queryForm.NewValue;
            //        //dgv.CurrentRow.Cells["discount_money"].Value = DBNull.Value;
            //        //dgv.CurrentRow.Cells["apply_money"].Value = DBNull.Value;
            //        //dgv.CurrentRow.Cells["approve_flag"].Value = "False";
            //        //SaveChanged();

            //    }
            //    return;

            //}


            /////////////////////////////////////////////////////////
        }
예제 #10
0
        private void bindingNavigatorDeleteItem1_Click(object sender, EventArgs e)
        {
            if (null == ly_plan_getmaterialDataGridView.CurrentRow)
            {
                return;
            }

            string salespeople = this.ly_plan_getmaterialDataGridView.CurrentRow.Cells["录入人5"].Value.ToString();

            if (salespeople != SQLDatabase.nowUserName())
            {
                MessageBox.Show("请录入人:" + salespeople + "删除", "注意");
                return;
            }

            //if ("True" == ly_sales_contract_mainDataGridView.CurrentRow.Cells["提交"].Value.ToString())
            //{
            //    MessageBox.Show("合同已经提交,不能删除数据...", "注意");
            //    return;

            //}

            //if ("True" == ly_sales_contract_mainDataGridView.CurrentRow.Cells["批准"].Value.ToString())
            //{
            //    MessageBox.Show("合同已经执行,不能删除数据...", "注意");
            //    return;

            //}

            //if ("True" == ly_sales_contract_mainDataGridView.CurrentRow.Cells["审核"].Value.ToString())
            //{
            //    MessageBox.Show("合同已经审批,不能删除数据...", "注意");
            //    return;

            //}


            string            message = "确定删除当前配套产品吗?";
            string            caption = "提示...";
            MessageBoxButtons buttons = MessageBoxButtons.YesNo;
            DialogResult      result;



            result = MessageBox.Show(message, caption, buttons,
                                     MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);

            if (result == DialogResult.Yes)
            {
                this.ly_plan_getmaterialBindingSource.RemoveCurrent();


                ly_plan_getmaterialDataGridView.EndEdit();
                ly_plan_getmaterialBindingSource.EndEdit();



                this.ly_plan_getmaterialTableAdapter.Update(this.lYSalseMange.ly_plan_getmaterial);


                //this.ly_sales_contract_detailTableAdapter.Fill(this.lYSalseMange.ly_sales_contract_detail, nowinnerCode, 0);

                if (null != ly_plan_getmaterialDataGridView.CurrentRow)
                {
                    string nowitemno = ly_plan_getmaterialDataGridView.CurrentRow.Cells["产品编号5"].Value.ToString();
                    //this.ly_sales_contract_detailBindingSource.Position = this.ly_sales_contract_detailBindingSource.Find("产品编码", nowitemno);
                }

                string nowplannum = ly_material_plan_mainDataGridView.CurrentRow.Cells["计划编号0"].Value.ToString();
                string nowNodeTag = this.treeView2.SelectedNode.Tag.ToString();
                MakeGroupTreeView(nowplannum);

                this.treeView2.SelectedNode = FindGroupNode(this.treeView2.Nodes, nowNodeTag);


                //this.ly_sales_contract_main1DataGridView.SelectionChanged -= ly_sales_contract_main1DataGridView_SelectionChanged;
                //this.ly_sales_contract_main1TableAdapter.Fill(this.lYSalseMange.ly_sales_contract_main1, this.nowusercode, "single", this.dateTimePicker1.Value, this.dateTimePicker2.Value);
                //this.ly_sales_contract_main1DataGridView.SelectionChanged += ly_sales_contract_main1DataGridView_SelectionChanged;
            }
        }
예제 #11
0
        private void RestoreProcedure()
        {
            string queryString;

            string[] queryArray;



            queryString = "     " + "\r\n";
            queryString = queryString + " WITH ENCRYPTION " + "\r\n";
            queryString = queryString + " AS " + "\r\n";
            queryString = queryString + "       SELECT      ProductID, Description, LogoGenerator, EntryDate, Remarks " + "\r\n";
            queryString = queryString + "       FROM        ListProduct " + "\r\n";
            queryString = queryString + "       ORDER BY    Description " + "\r\n";

            SQLDatabase.CreateStoredProcedure("ListProductListing", queryString);



            queryString = "     @ProductID Int " + "\r\n";
            queryString = queryString + " WITH ENCRYPTION " + "\r\n";
            queryString = queryString + " AS " + "\r\n";
            queryString = queryString + "       SELECT      ProductID, Description, LogoGenerator, EntryDate, Remarks, UserID, UserOrganizationID, EntryStatusID " + "\r\n";
            queryString = queryString + "       FROM        ListProduct " + "\r\n";
            queryString = queryString + "       WHERE       ProductID = @ProductID " + "\r\n";

            SQLDatabase.CreateStoredProcedure("ListProductSelect", queryString);


            queryString = "     @Description nvarchar(100),	@LogoGenerator nvarchar(100), @EntryDate datetime, @Remarks nchar(10), @UserID int, @UserOrganizationID int, @EntryStatusID int " + "\r\n";
            queryString = queryString + " WITH ENCRYPTION " + "\r\n";
            queryString = queryString + " AS " + "\r\n";
            queryString = queryString + "       INSERT INTO ListProduct ([Description], [LogoGenerator], [EntryDate], [Remarks], [UserID], [UserOrganizationID], [EntryStatusID]) VALUES (@Description, @LogoGenerator, @EntryDate, @Remarks, @UserID, @UserOrganizationID, @EntryStatusID) " + "\r\n";
            queryString = queryString + "       SELECT      ProductID, Description, LogoGenerator, EntryDate, Remarks, UserID, UserOrganizationID, EntryStatusID FROM ListProduct WHERE ProductID = SCOPE_IDENTITY() " + "\r\n";

            SQLDatabase.CreateStoredProcedure("ListProductInsert", queryString);


            queryString = "     @ProductID int, @Description nvarchar(100), @LogoGenerator nvarchar(100), @EntryDate datetime, @Remarks nchar(10), @UserID int, @UserOrganizationID int, @EntryStatusID int " + "\r\n";
            queryString = queryString + " WITH ENCRYPTION " + "\r\n";
            queryString = queryString + " AS " + "\r\n";
            queryString = queryString + "       UPDATE      ListProduct SET [Description] = @Description, [LogoGenerator] = @LogoGenerator, [EntryDate] = @EntryDate, [Remarks] = @Remarks, [UserID] = @UserID, [UserOrganizationID] = @UserOrganizationID, [EntryStatusID] = @EntryStatusID WHERE ProductID = @ProductID " + "\r\n";
            queryString = queryString + "       SELECT      ProductID, Description, LogoGenerator, EntryDate, Remarks, UserID, UserOrganizationID, EntryStatusID FROM ListProduct WHERE ProductID = @ProductID " + "\r\n";

            SQLDatabase.CreateStoredProcedure("ListProductUpdate", queryString);


            queryString = " @ProductID int ";
            queryString = queryString + " WITH ENCRYPTION " + "\r\n";
            queryString = queryString + " AS " + "\r\n";
            queryString = queryString + "       DELETE FROM ListProduct WHERE ProductID = @ProductID " + "\r\n";
            SQLDatabase.CreateStoredProcedure("ListProductDelete", queryString);



            queryString = " @ProductID int " + "\r\n";
            queryString = queryString + " WITH ENCRYPTION " + "\r\n";
            queryString = queryString + " AS " + "\r\n";
            queryString = queryString + "       SELECT      ProductID, SerialID, CommonID, CommonValue, Remarks " + "\r\n";
            queryString = queryString + "       FROM        ListProductDetail " + "\r\n";
            queryString = queryString + "       WHERE       ProductID = @ProductID " + "\r\n";

            SQLDatabase.CreateStoredProcedure("ListProductDetailSelect", queryString);


            queryString = " @ProductID int, @SerialID int,	@CommonID int, @CommonValue float, @Remarks nvarchar(100) "+ "\r\n";
            queryString = queryString + " WITH ENCRYPTION " + "\r\n";
            queryString = queryString + " AS " + "\r\n";
            queryString = queryString + "       INSERT INTO ListProductDetail (ProductID, SerialID, CommonID, CommonValue, Remarks) VALUES (@ProductID, @SerialID, @CommonID, @CommonValue, @Remarks) " + "\r\n";
            queryString = queryString + "       SELECT      ProductID, SerialID, CommonID, CommonValue, Remarks FROM ListProductDetail WHERE (ProductID = @ProductID) AND (SerialID = @SerialID) " + "\r\n";

            SQLDatabase.CreateStoredProcedure("ListProductDetailInsert", queryString);



            queryString = " @ProductID int, @SerialID int,	@CommonID int, @CommonValue float, @Remarks nvarchar(100) "+ "\r\n";
            queryString = queryString + " WITH ENCRYPTION " + "\r\n";
            queryString = queryString + " AS " + "\r\n";
            queryString = queryString + "       UPDATE      ListProductDetail SET CommonID = @CommonID, CommonValue = @CommonValue, Remarks = @Remarks WHERE ProductID = @ProductID AND SerialID = @SerialID " + "\r\n";
            queryString = queryString + "       SELECT      ProductID, SerialID, CommonID, CommonValue, Remarks FROM ListProductDetail WHERE ProductID = @ProductID AND SerialID = @SerialID " + "\r\n";

            SQLDatabase.CreateStoredProcedure("ListProductDetailUpdate", queryString);



            queryString = " @ProductID int " + "\r\n";
            queryString = queryString + " WITH ENCRYPTION " + "\r\n";
            queryString = queryString + " AS " + "\r\n";
            queryString = queryString + "       DELETE FROM ListProductDetail WHERE ProductID = @ProductID " + "\r\n";
            SQLDatabase.CreateStoredProcedure("ListProductDetailDelete", queryString);



            /// <summary>
            /// Check for editable
            /// </summary>
            queryArray    = new string[1];
            queryArray[0] = "   SELECT      TOP 1 ProductID FROM DataMessageMaster WHERE ProductID = @FindIdentityID ";

            SQLDatabase.CreateProcedureToCheckExisting("ListProductEditable", queryArray);
        }
예제 #12
0
        private void ly_pay_grid_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (ly_pay_grid.CurrentRow == null)
            {
                ly_pay_contract_cgTableAdapter.Fill(this.LYStoreMange.ly_pay_contract_cg, "");
                return;
            }
            DataGridView dgv = sender as DataGridView;


            if ("审批" == dgv.CurrentCell.OwningColumn.Name)
            {
                if (dgv.CurrentRow.Cells["审定"].Value.ToString() == "True")
                {
                    MessageBox.Show("已经审定...", "注意");
                    return;
                }
                if (!SQLDatabase.CheckHaveRight(SQLDatabase.NowUserID, "付款审批"))
                {
                    MessageBox.Show("无付款审批权限", "注意");
                    return;
                }
                if ("True" == dgv.CurrentRow.Cells["审批"].Value.ToString())
                {
                    dgv.CurrentRow.Cells["审批"].Value   = "False";
                    dgv.CurrentRow.Cells["审批人"].Value  = DBNull.Value;
                    dgv.CurrentRow.Cells["审批时间"].Value = DBNull.Value;
                }
                else
                {
                    dgv.CurrentRow.Cells["审批"].Value   = "True";
                    dgv.CurrentRow.Cells["审批人"].Value  = SQLDatabase.nowUserName();
                    dgv.CurrentRow.Cells["审批时间"].Value = SQLDatabase.GetNowtime();
                }

                return;
            }

            if ("审定" == dgv.CurrentCell.OwningColumn.Name)
            {
                if (dgv.CurrentRow.Cells["付款"].Value.ToString() == "True")
                {
                    MessageBox.Show("已经付款...", "注意");
                    return;
                }
                if (!SQLDatabase.CheckHaveRight(SQLDatabase.NowUserID, "付款审定"))
                {
                    MessageBox.Show("无付款审定权限", "注意");
                    return;
                }

                if ("True" == dgv.CurrentRow.Cells["审定"].Value.ToString())
                {
                    dgv.CurrentRow.Cells["审定"].Value   = "False";
                    dgv.CurrentRow.Cells["审定人"].Value  = DBNull.Value;
                    dgv.CurrentRow.Cells["审定时间"].Value = DBNull.Value;
                }
                else
                {
                    dgv.CurrentRow.Cells["审定"].Value   = "True";
                    dgv.CurrentRow.Cells["审定人"].Value  = SQLDatabase.nowUserName();
                    dgv.CurrentRow.Cells["审定时间"].Value = SQLDatabase.GetNowtime();
                }
                return;
            }
            this.ly_pay_grid.EndEdit();
            this.lyinvoicepaytimeBindingSource.EndEdit();
            this.ly_invoice_pay_timeTableAdapter.Update(this.LYStoreMange.ly_invoice_pay_time);

            loaddata();
        }
예제 #13
0
 public void WhenIQueryThePortalDatabaseWith(string sql)
 {
     Assert.Greater(sql.Length, 0);
     _queryResult = SQLDatabase.ReturnQuery(_connectionString, sql);
     Assert.AreNotEqual(_queryResult, "", "The result from the query should not be nothing");
 }
예제 #14
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            //this.ly_sales_clientBindingSource.Filter = e.Node.Tag.ToString() ;
            this.nowfilterStr = e.Node.Tag.ToString();

            if (e.Node.Level == 2)
            {
                //this.ly_sales_clientDataGridView.Columns["yhbm"].Visible = false;
                //this.ly_sales_clientDataGridView.Columns["yhmc"].Visible = false;

                this.nowusercode       = this.nowfilterStr.Substring(this.nowfilterStr.Length - 4, 3);
                this.nowfillstragecode = "single";


                //this.ly_sales_contract_main1DataGridView.SelectionChanged -= ly_sales_contract_main1DataGridView_SelectionChanged;
                //this.ly_sales_contract_main1TableAdapter.Fill(this.lYSalseMange.ly_sales_contract_main1, this.nowusercode,"single", this.dateTimePicker1.Value , this.dateTimePicker2.Value );
                //AddSummationRow_New(ly_sales_contract_main1BindingSource, ly_sales_contract_main1DataGridView);
                //this.ly_sales_contract_main1DataGridView.SelectionChanged += ly_sales_contract_main1DataGridView_SelectionChanged;
            }
            else if (e.Node.Level == 1)
            {
                //this.ly_sales_clientDataGridView.Columns["yhbm"].Visible = true ;
                //this.ly_sales_clientDataGridView.Columns["yhmc"].Visible = true ;

                this.nowusercode       = this.nowfilterStr.Substring(this.nowfilterStr.Length - 3, 2);
                this.nowfillstragecode = "region";

                //this.ly_sales_contract_main1DataGridView.SelectionChanged -= ly_sales_contract_main1DataGridView_SelectionChanged;
                //this.ly_sales_contract_main1TableAdapter.Fill(this.lYSalseMange.ly_sales_contract_main1, this.nowusercode, "region", this.dateTimePicker1.Value, this.dateTimePicker2.Value);
                //AddSummationRow_New(ly_sales_contract_main1BindingSource, ly_sales_contract_main1DataGridView);
                //this.ly_sales_contract_main1DataGridView.SelectionChanged += ly_sales_contract_main1DataGridView_SelectionChanged;
            }
            else if (e.Node.Level == 0)
            {
                //this.ly_sales_clientDataGridView.Columns["yhbm"].Visible = true;
                //this.ly_sales_clientDataGridView.Columns["yhmc"].Visible = true;
                if (SQLDatabase.CheckHaveRight(SQLDatabase.NowUserID, "营业维修综合信息"))
                {
                    this.nowusercode       = "";
                    this.nowfillstragecode = "full";
                }
                else
                {
                    this.nowusercode       = SQLDatabase.NowUserID;
                    this.nowfillstragecode = "single";
                }

                //this.ly_sales_contract_main1DataGridView.SelectionChanged -= ly_sales_contract_main1DataGridView_SelectionChanged;
                //this.ly_sales_contract_main1TableAdapter.Fill(this.lYSalseMange.ly_sales_contract_main1, this.nowusercode, "full", this.dateTimePicker1.Value, this.dateTimePicker2.Value);
                //AddSummationRow_New(ly_sales_contract_main1BindingSource, ly_sales_contract_main1DataGridView);
                //this.ly_sales_contract_main1DataGridView.SelectionChanged += ly_sales_contract_main1DataGridView_SelectionChanged;
            }

            //this.ly_sales_standard_Report_giveTableAdapter.Fill(this.lYSalseMange.ly_sales_borrow_detail_all, this.nowusercode, this.nowfillstragecode, this.dateTimePicker1.Value, this.dateTimePicker2.Value);
            //this.ly_sales_repairstandard_ReportTableAdapter.Fill(this.lYSalseMange2.ly_sales_repairstandard_Report, this.nowusercode, this.nowfillstragecode, this.dateTimePicker3.Value, this.dateTimePicker4.Value.AddDays(1));
            //AddSummationRow_New(ly_sales_repairstandard_ReportBindingSource, ly_sales_contract_standard_ReportDataGridView);

            //this.ly_sales_repair_replacementTableAdapter.Fill(this.lYSalseRepair.ly_sales_repair_replacement, this.nowusercode, this.nowfillstragecode, this.dateTimePicker1.Value, this.dateTimePicker2.Value.AddDays(1));
            this.ly_SalseRepair_SumQuery_ReportTableAdapter.Fill(this.lYSalseRepair.ly_SalseRepair_SumQuery_Report, this.nowusercode, this.nowfillstragecode, this.dateTimePicker3.Value, this.dateTimePicker4.Value.AddDays(1), this.nowdatetype);
            this.ly_SalseRepair_SumQuery_ReportAllTableAdapter.Fill(this.lYSalseRepair.ly_SalseRepair_SumQuery_ReportAll, this.nowusercode, this.nowfillstragecode, this.dateTimePicker3.Value, this.dateTimePicker4.Value.AddDays(1), this.nowdatetype);

            if (this.tabControl1.SelectedIndex == 1)
            {
                NewFrm.Show(this);
                this.ly_sales_receive_itemDetail_repairDetailTableAdapter.Fill(this.lYSalseRepair.ly_sales_receive_itemDetail_repairDetail, this.nowusercode, this.nowfillstragecode, this.dateTimePicker5.Value, this.dateTimePicker6.Value.AddDays(1), this.nowdatetypedetail);
                NewFrm.Hide(this);
            }
        }
예제 #15
0
        private void ly_invoice_detailDataGridView_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (ly_invoice_detailDataGridView.CurrentRow == null || null == ly_fpDataGridView.CurrentRow)
            {
                return;
            }
            DataGridView dgv = sender as DataGridView;

            ////////////////////////000

            if ("adjust_fee" == dgv.CurrentCell.OwningColumn.Name && "000" == SQLDatabase.NowUserID)
            {
                ChangeValue queryForm = new ChangeValue();

                queryForm.OldValue   = dgv.CurrentCell.Value.ToString();
                queryForm.NewValue   = "";
                queryForm.ChangeMode = "value";
                queryForm.ShowDialog();

                if (queryForm.NewValue != "")
                {
                    decimal adjustBindmoney = decimal.Parse(queryForm.NewValue);

                    if (1 > Math.Abs(adjustBindmoney))
                    {
                        dgv.CurrentRow.Cells["adjust_fee"].Value = queryForm.NewValue;
                    }
                    else
                    {
                        MessageBox.Show("校正绑定金额不能超过1...", "注意");
                        return;
                    }
                }

                else
                {
                    return;
                }



                this.ly_invoice_detailDataGridView.EndEdit();
                this.lyinvoicedetailNewBindingSource.EndEdit();
                this.ly_invoice_detail_NewTableAdapter.Update(this.lYStoreMange.ly_invoice_detail_New);


                string store_id = ly_invoice_detailDataGridView.CurrentRow.Cells["instore_id0"].Value.ToString();

                int id_main = int.Parse(this.ly_fpDataGridView.CurrentRow.Cells["id_main"].Value.ToString());

                loadData();
                lyinvoiceBindingSource.Position = lyinvoiceBindingSource.Find("id", id_main);
                string supplier_code = this.ly_fpDataGridView.CurrentRow.Cells["客户编码"].Value.ToString();
                this.ly_invoice_detail_NewTableAdapter.Fill(this.lYStoreMange.ly_invoice_detail_New, id_main, supplier_code);



                this.lY_Invoice_Instore_BindlistTableAdapter.Fill(this.lYStoreMange.LY_Invoice_Instore_Bindlist, supplier_code, "");

                this.lyinvoicedetailNewBindingSource.Position          = lyinvoicedetailNewBindingSource.Find("instore_id", store_id);
                this.lY_Invoice_Instore_BindlistBindingSource.Position = lY_Invoice_Instore_BindlistBindingSource.Find("id", store_id);

                return;
            }



            ////////////////////////000
            string salespeople = this.ly_fpDataGridView.CurrentRow.Cells["录入人"].Value.ToString();

            if (!string.IsNullOrEmpty(salespeople))
            {
                if (salespeople != SQLDatabase.nowUserName())
                {
                    MessageBox.Show("请录入人:" + salespeople + "操作", "注意");
                    return;
                }
            }

            if (ly_fpDataGridView.CurrentRow.Cells["lock_flag"].Value.ToString() == "True")
            {
                MessageBox.Show("已经锁定无法操作...", "注意");
                return;
            }

            if ("True" == ly_fpDataGridView.CurrentRow.Cells["提交"].Value.ToString())
            {
                MessageBox.Show("已经提交无法操作...", "注意");
                return;
            }



            if ("bind_qty0" == dgv.CurrentCell.OwningColumn.Name)
            {
                ChangeValue queryForm = new ChangeValue();

                queryForm.OldValue   = dgv.CurrentCell.Value.ToString();
                queryForm.NewValue   = "";
                queryForm.ChangeMode = "value";
                queryForm.ShowDialog();

                if (queryForm.NewValue != "")
                {
                    string store_id = ly_invoice_detailDataGridView.CurrentRow.Cells["instore_id0"].Value.ToString();
                    for (int i = 0; i < lY_Invoice_Instore_BindlistDataGridView.Rows.Count; i++)
                    {
                        if (lY_Invoice_Instore_BindlistDataGridView.Rows[i].Cells["store_id"].Value.ToString() == store_id)
                        {
                            if (decimal.Parse(queryForm.NewValue) > (decimal.Parse(lY_Invoice_Instore_BindlistDataGridView.Rows[i].Cells["qty_in"].Value.ToString()) -
                                                                     decimal.Parse(lY_Invoice_Instore_BindlistDataGridView.Rows[i].Cells["bind_qty"].Value.ToString()) + decimal.Parse(queryForm.OldValue)))
                            {
                                MessageBox.Show("修改的数量超过未绑定数量...", "注意");
                                return;
                            }
                        }
                    }
                    string  id_detail      = ly_invoice_detailDataGridView.CurrentRow.Cells["id_detail"].Value.ToString();
                    decimal contract_price = decimal.Parse(ly_invoice_detailDataGridView.CurrentRow.Cells["contract_price0"].Value.ToString());


                    decimal fp_money = decimal.Parse(ly_fpDataGridView.CurrentRow.Cells["invoice_money_novat"].Value.ToString());

                    decimal sumBindmoney = 0;
                    for (int i = 0; i < ly_invoice_detailDataGridView.Rows.Count; i++)
                    {
                        if (ly_invoice_detailDataGridView.Rows[i].Cells["id_detail"].Value.ToString() != id_detail)
                        {
                            //20190409   sumBindmoney += decimal.Parse(ly_invoice_detailDataGridView.Rows[i].Cells["bind_money"].Value.ToString() == "" ? "0" : ly_invoice_detailDataGridView.Rows[i].Cells["bind_money"].Value.ToString());
                            sumBindmoney += decimal.Parse(ly_invoice_detailDataGridView.Rows[i].Cells["bind_money_novat2"].Value.ToString() == "" ? "0" : ly_invoice_detailDataGridView.Rows[i].Cells["bind_money_novat2"].Value.ToString());
                        }
                    }
                    decimal nowbind = contract_price * decimal.Parse(queryForm.NewValue);
                    if ((nowbind + sumBindmoney) > fp_money)
                    {
                        //MessageBox.Show("修改后的总绑定金额超过发票金额...", "注意");
                        //return;
                    }
                    dgv.CurrentRow.Cells["bind_qty0"].Value = queryForm.NewValue;


                    this.ly_invoice_detailDataGridView.EndEdit();
                    this.lyinvoicedetailNewBindingSource.EndEdit();
                    this.ly_invoice_detail_NewTableAdapter.Update(this.lYStoreMange.ly_invoice_detail_New);



                    int id_main = int.Parse(this.ly_fpDataGridView.CurrentRow.Cells["id_main"].Value.ToString());

                    loadData();
                    lyinvoiceBindingSource.Position = lyinvoiceBindingSource.Find("id", id_main);
                    string supplier_code = this.ly_fpDataGridView.CurrentRow.Cells["客户编码"].Value.ToString();
                    this.ly_invoice_detail_NewTableAdapter.Fill(this.lYStoreMange.ly_invoice_detail_New, id_main, supplier_code);



                    this.lY_Invoice_Instore_BindlistTableAdapter.Fill(this.lYStoreMange.LY_Invoice_Instore_Bindlist, supplier_code, "");

                    this.lyinvoicedetailNewBindingSource.Position          = lyinvoicedetailNewBindingSource.Find("instore_id", store_id);
                    this.lY_Invoice_Instore_BindlistBindingSource.Position = lY_Invoice_Instore_BindlistBindingSource.Find("id", store_id);
                }

                return;
            }

            ////////////////////////000

            if ("adjust_fee" == dgv.CurrentCell.OwningColumn.Name)
            {
                ChangeValue queryForm = new ChangeValue();

                queryForm.OldValue   = dgv.CurrentCell.Value.ToString();
                queryForm.NewValue   = "";
                queryForm.ChangeMode = "value";
                queryForm.ShowDialog();

                if (queryForm.NewValue != "")
                {
                    decimal adjustBindmoney = decimal.Parse(queryForm.NewValue);

                    if (1 > Math.Abs(adjustBindmoney))
                    {
                        dgv.CurrentRow.Cells["adjust_fee"].Value = queryForm.NewValue;
                    }
                    else
                    {
                        MessageBox.Show("校正绑定金额不能超过1...", "注意");
                        return;
                    }
                }

                else
                {
                    return;
                }



                this.ly_invoice_detailDataGridView.EndEdit();
                this.lyinvoicedetailNewBindingSource.EndEdit();
                this.ly_invoice_detail_NewTableAdapter.Update(this.lYStoreMange.ly_invoice_detail_New);


                string store_id = ly_invoice_detailDataGridView.CurrentRow.Cells["instore_id0"].Value.ToString();

                int id_main = int.Parse(this.ly_fpDataGridView.CurrentRow.Cells["id_main"].Value.ToString());

                loadData();
                lyinvoiceBindingSource.Position = lyinvoiceBindingSource.Find("id", id_main);
                string supplier_code = this.ly_fpDataGridView.CurrentRow.Cells["客户编码"].Value.ToString();
                this.ly_invoice_detail_NewTableAdapter.Fill(this.lYStoreMange.ly_invoice_detail_New, id_main, supplier_code);



                this.lY_Invoice_Instore_BindlistTableAdapter.Fill(this.lYStoreMange.LY_Invoice_Instore_Bindlist, supplier_code, "");

                this.lyinvoicedetailNewBindingSource.Position          = lyinvoicedetailNewBindingSource.Find("instore_id", store_id);
                this.lY_Invoice_Instore_BindlistBindingSource.Position = lY_Invoice_Instore_BindlistBindingSource.Find("id", store_id);

                return;
            }



            ////////////////////////000


            if ("bind_additional_fee" == dgv.CurrentCell.OwningColumn.Name)
            {
                ChangeValue queryForm = new ChangeValue();

                queryForm.OldValue   = dgv.CurrentCell.Value.ToString();
                queryForm.NewValue   = "";
                queryForm.ChangeMode = "value";
                queryForm.ShowDialog();

                if (queryForm.NewValue != "")
                {
                    string store_id = ly_invoice_detailDataGridView.CurrentRow.Cells["instore_id0"].Value.ToString();

                    dgv.CurrentRow.Cells["bind_additional_fee"].Value = queryForm.NewValue;


                    this.ly_invoice_detailDataGridView.EndEdit();
                    this.lyinvoicedetailNewBindingSource.EndEdit();
                    this.ly_invoice_detail_NewTableAdapter.Update(this.lYStoreMange.ly_invoice_detail_New);



                    int id_main = int.Parse(this.ly_fpDataGridView.CurrentRow.Cells["id_main"].Value.ToString());

                    loadData();
                    lyinvoiceBindingSource.Position = lyinvoiceBindingSource.Find("id", id_main);
                    string supplier_code = this.ly_fpDataGridView.CurrentRow.Cells["客户编码"].Value.ToString();
                    this.ly_invoice_detail_NewTableAdapter.Fill(this.lYStoreMange.ly_invoice_detail_New, id_main, supplier_code);



                    this.lY_Invoice_Instore_BindlistTableAdapter.Fill(this.lYStoreMange.LY_Invoice_Instore_Bindlist, supplier_code, "");

                    this.lyinvoicedetailNewBindingSource.Position          = lyinvoicedetailNewBindingSource.Find("instore_id", store_id);
                    this.lY_Invoice_Instore_BindlistBindingSource.Position = lY_Invoice_Instore_BindlistBindingSource.Find("id", store_id);
                }

                return;
            }
        }
예제 #16
0
        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            if (null == this.ly_store_outnumDailyDataGridView.CurrentRow)
            {
                return;
            }



            string nowoperptar = this.ly_store_outnumDailyDataGridView.CurrentRow.Cells["发料人0"].Value.ToString();

            if (nowoperptar != SQLDatabase.nowUserName())
            {
                MessageBox.Show("请发料人:" + nowoperptar + "删除", "注意");
                return;
            }

            if ("True" == ly_store_outnumDailyDataGridView.CurrentRow.Cells["签证0"].Value.ToString())
            {
                MessageBox.Show("已经签证,不能删除出库单...");

                return;
            }



            string outnumber = ly_store_outnumDailyDataGridView.CurrentRow.Cells["出库单号0"].Value.ToString();
            string storename = ly_store_outnumDailyDataGridView.CurrentRow.Cells["仓库"].Value.ToString();

            string            message = "删除当前领料单:" + outnumber + "吗?";
            string            caption = "提示...";
            MessageBoxButtons buttons = MessageBoxButtons.YesNo;

            DialogResult result;



            result = MessageBox.Show(message, caption, buttons,
                                     MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

            if (result == DialogResult.Yes)
            {
                string delstr = " delete ly_store_out  from ly_store_out left join ly_inma0010 on ly_store_out.wzbh=ly_inma0010.wzbh  " +
                                " where ly_store_out.out_number = '" + outnumber + "' and ly_inma0010.warehouse='" + storename + "'";


                SqlConnection sqlConnection1 = new SqlConnection(SQLDatabase.Connectstring);
                SqlCommand    cmd            = new SqlCommand();

                cmd.CommandText = delstr;
                cmd.CommandType = CommandType.Text;
                cmd.Connection  = sqlConnection1;

                int temp = 0;

                using (TransactionScope scope = new TransactionScope())
                {
                    sqlConnection1.Open();
                    try
                    {
                        cmd.ExecuteNonQuery();



                        scope.Complete();
                        temp = 1;
                    }
                    catch (SqlException sqle)
                    {
                        MessageBox.Show(sqle.Message.Split('*')[0]);
                    }


                    finally
                    {
                        sqlConnection1.Close();
                    }
                }
                if (1 == temp)
                {
                    //this.ly_material_plan_mainTableAdapter.Fill(this.lYPlanMange.ly_material_plan_main, "SCJH");
                }

                string nowcontract = this.ly_outsource_contract_detailQClistDataGridView.CurrentRow.Cells["合同编号0"].Value.ToString();
                string wzbh        = this.ly_outsource_contract_detailQClistDataGridView.CurrentRow.Cells["物料编号0"].Value.ToString();



                this.ly_outsource_order_materialrequisition_newTableAdapter.Fill(this.lYOutsourceData.ly_outsource_order_materialrequisition_new, nowcontract, wzbh);
                this.ly_store_outnum_outsourceTableAdapter.Fill(this.lYOutsourceData.ly_store_outnum_outsource, nowcontract);
            }
        }
예제 #17
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(client_code.Text))
            {
                MessageBox.Show("客户不能为空!"); return;
            }
            if (string.IsNullOrEmpty(supplier_financial_code.Text))
            {
                MessageBox.Show("结算编码不能为空!"); return;
            }
            if (!(Regex.IsMatch(this.invoice_rate.Text, @"^([-]{1}[0-9]+(.[0-9]{2})?$)|([0-9]+(.[0-9]{2})?$)"))) // ^\+?[1-9][0-9]*$
            {
                MessageBox.Show("数字格式错误,请重新输入");
                this.invoice_rate.Focus();
                return;
            }
            if (string.IsNullOrEmpty(invoice_code.Text))
            {
                MessageBox.Show("发票号不能为空!"); invoice_code.Focus(); return;
            }
            if (!(Regex.IsMatch(this.invoice_money.Text, @"^([-]{1}[0-9]+(.[0-9]{2})?$)|([0-9]+(.[0-9]{2})?$)"))) // ^\+?[1-9][0-9]*$
            {
                MessageBox.Show("数字格式错误,请重新输入");
                this.invoice_money.Focus();
                return;
            }
            if (string.IsNullOrEmpty(dateTimePicker1.Text))
            {
                MessageBox.Show("开票日期格式错误,请重新输入");
                this.dateTimePicker1.Focus();
                return;
            }
            DataTable dt    = null;
            string    check = "select count(1) from ly_invoice where invoice_code='" + invoice_code.Text + "'";

            using (SqlConnection connection = new SqlConnection(SQLDatabase.Connectstring))
            {
                SqlDataAdapter adapter = new SqlDataAdapter(check, connection);
                DataSet        ds      = new DataSet();
                adapter.Fill(ds);
                dt = ds.Tables[0];
            }
            if (dt.Rows[0][0].ToString() == "0")
            {
                string rs  = radioButton1.Checked ? "专票" : "普票";
                string sql = @"insert into ly_invoice (client_code,client_name,invoice_code,invoice_date ,invoice_money,invoice_rate,sava_people,save_time ,invoice_type,supplier_financial_code)
                               values ('" + client_code.Text + "' ,'" + client_name.Text + "' ,'" + invoice_code.Text + "' ,'" + dateTimePicker1.Text + "','" +
                             invoice_money.Text + "','" + invoice_rate.Text + "','" + SQLDatabase.nowUserName() + "','" + SQLDatabase.GetNowtime() + "', '" + rs + "', '" + supplier_financial_code.Text + "')";
                using (SqlConnection con = new SqlConnection(SQLDatabase.Connectstring))
                {
                    using (SqlCommand cmd = new SqlCommand(sql, con))
                    {
                        con.Open();
                        cmd.ExecuteNonQuery();
                    }
                }
                invoice_code_add  = invoice_code.Text;
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("发票号已经存在,请重新输入"); return;
            }
        }
예제 #18
0
        //20170116 adding commentws for email notification
        //public static void SendNotifications<T>( HttpServerUtility server, GCCPropertyShortCode property, SurveyType surveyType, NotificationReason reason, T replacementModel, string emailAddress, string subjectPrefix )
        public static void SendNotifications <T>(HttpServerUtility server, GCCPropertyShortCode property, SurveyType surveyType, NotificationReason reason, string Comments, T replacementModel, string emailAddress, string subjectPrefix, int operationsArea)
            where T : class
        {
            string template     = String.Empty;
            string title        = String.Empty;
            string propertyName = PropertyTools.GetCasinoName((int)property);

            if (property == GCCPropertyShortCode.GAG)
            {
                PropertyInfo nameProp = replacementModel.GetType().GetProperty("CasinoName");
                if (nameProp != null)
                {
                    string name = nameProp.GetValue(replacementModel) as string;
                    if (!String.IsNullOrWhiteSpace(name))
                    {
                        propertyName = name;
                    }
                }
            }
            switch (surveyType)
            {
            case SurveyType.GEI:
                if (reason == NotificationReason.ThankYou)
                {
                    title    = "Thank You For Your Feedback";
                    template = "GEIThankYou";
                }
                else
                {
                    template = "GEITemplate";
                    title    = String.Format("{0}GEI Feedback Notification for {1} - {2}", subjectPrefix, propertyName, DateTime.Now.ToString("MMMM dd, yyyy"));
                }
                break;

            case SurveyType.GEIProblemResolution:
                if (reason == NotificationReason.ThankYou)
                {
                    title    = "Thank You For Your Feedback";
                    template = "GEIThankYou";
                }
                else
                {
                    if (replacementModel.ToString().Contains("FeedbackCategory"))
                    {
                        template = "GEIFeedbackCategoryTemplate";
                        title    = String.Format("{0}GEI Feedback Category Notification for {1} - {2}", subjectPrefix, propertyName, DateTime.Now.ToString("MMMM dd, yyyy"));
                    }
                    else
                    {
                        template = "GEITemplate";
                        title    = String.Format("{0}GEI Problem Resolution Feedback Notification for {1} - {2}", subjectPrefix, propertyName, DateTime.Now.ToString("MMMM dd, yyyy"));
                    }
                }
                break;

            case SurveyType.Hotel:
                if (reason == NotificationReason.ThankYou)
                {
                    title    = "Thank You For Your Feedback";
                    template = "HotelThankYou";
                }
                else
                {
                    template = "HotelTemplate";
                    title    = String.Format("{0}Hotel Survey Notification - {1}", subjectPrefix, DateTime.Now.ToString("MMMM dd, yyyy"));
                }
                break;

            case SurveyType.Feedback:
                if (reason == NotificationReason.ThankYou)
                {
                    title    = "Thank You For Your Feedback";
                    template = "FeedbackThankYou";
                }
                else if (reason == NotificationReason.Tier3Alert)
                {
                    title    = String.Format("{0}Tier 3 Alert for {1} - {2}", subjectPrefix, propertyName, DateTime.Now.ToString("MMMM dd, yyyy"));
                    template = "Tier3Alert";
                }
                else
                {
                    template = "FeedbackTemplate";
                    title    = String.Format("{0}Feedback Follow-up Notification for {1} - {2}", subjectPrefix, propertyName, DateTime.Now.ToString("MMMM dd, yyyy"));
                }
                break;

            case SurveyType.Donation:
                template = "DonationTemplate";
                title    = String.Format("{0}Sponsorship / Donation Request Notification for {1} - {2}", subjectPrefix, propertyName, DateTime.Now.ToString("MMMM dd, yyyy"));
                break;
            }
            if (template.Equals(String.Empty))
            {
                return;
            }
            MailMessage msg = null;

            try {
                string path = server.MapPath("~/Content/notifications/");
                msg = EmailManager.CreateEmailFromTemplate(
                    Path.Combine(path, template + ".htm"),
                    Path.Combine(path, template + ".txt"),
                    replacementModel);
                PropertyInfo attachmentProp = replacementModel.GetType().GetProperty("Attachments");
                if (attachmentProp != null)
                {
                    SurveyAttachmentDetails[] attachments = attachmentProp.GetValue(replacementModel) as SurveyAttachmentDetails[];
                    foreach (SurveyAttachmentDetails att in attachments)
                    {
                        LinkedResource lr = new LinkedResource(server.MapPath(att.Path));
                        lr.ContentId = att.ContentID;
                        msg.AlternateViews[0].LinkedResources.Add(lr);
                    }
                }
                msg.From    = new MailAddress("*****@*****.**");
                msg.Subject = title;
                //Add high priority flag to tier 3 alerts
                if (reason == NotificationReason.Tier3Alert)
                {
                    msg.Priority = MailPriority.High;
                }
                bool hasAddress = false;
                if (!String.IsNullOrEmpty(emailAddress))
                {
                    msg.To.Add(emailAddress);
                    hasAddress = true;
                }
                else
                {
                    SQLDatabase sql = new SQLDatabase();    sql.CommandTimeout = 120;
                    DataTable   dt  = sql.QueryDataTable(@"
SELECT [SendType], u.[FirstName], u.[LastName],  u.[Email]
FROM [tblNotificationUsers] ne
	INNER JOIN [tblNotificationPropertySurveyReason] psr
		ON ne.[PropertySurveyReasonID] = psr.[PropertySurveyReasonID]
	INNER JOIN [tblCOM_Users] u
		ON ne.UserID = u.UserID
WHERE psr.PropertyID = @PropertyID
	AND psr.SurveyTypeID = @SurveyID
	AND psr.ReasonID = @ReasonID
	
;",
                                                         //AND ( ( @OperationsAreaID < 0 AND psr.OperationsAreaID IS NULL ) OR psr.OperationsAreaID = @OperationsAreaID )
                                                         new SQLParamList()
                                                         .Add("@PropertyID", (int)property)
                                                         .Add("@SurveyID", (int)surveyType)
                                                         .Add("@ReasonID", (int)reason)
                                                         .Add("@OperationsAreaID", operationsArea)
                                                         );
                    if (!sql.HasError && dt.Rows.Count > 0)
                    {
                        StringBuilder addrs = new StringBuilder();
                        foreach (DataRow dr in dt.Rows)
                        {
                            switch (dr["SendType"].ToString())
                            {
                            case "1":
                                msg.To.Add(dr["Email"].ToString());
                                //201701 Testing Email error
                                //msg.Bcc.Add("*****@*****.**");
                                addrs.Append(dr["FirstName"].ToString() + " " + dr["LastName"].ToString() + " <" + dr["Email"].ToString() + ">" + "\n");
                                hasAddress = true;
                                break;

                            case "2":
                                msg.CC.Add(dr["Email"].ToString());
                                //201701 Testing Email error
                                //msg.Bcc.Add("*****@*****.**");
                                //Colin requested that CC addresses not show on the call Aug 10,2015
                                //addrs.Append( dr["FirstName"].ToString() + " " + dr["LastName"].ToString() + " <" + dr["Email"].ToString() + ">" + "\n" );
                                hasAddress = true;
                                break;

                            case "3":
                                msg.Bcc.Add(dr["Email"].ToString());
                                //201701 Testing Email error
                                // msg.Bcc.Add("*****@*****.**");
                                hasAddress = true;
                                break;
                            }
                        }
                        using (StreamReader sr = new StreamReader(msg.AlternateViews[0].ContentStream)) {
                            msg.AlternateViews[0] = AlternateView.CreateAlternateViewFromString(sr.ReadToEnd().Replace("{Recipients}", server.HtmlEncode(addrs.ToString()).Replace("\n", "<br />")).Replace("{Business}", server.HtmlEncode(reason.ToString()).Replace("\n", "<br />")).Replace("{Comments}", server.HtmlEncode(Comments.ToString()).Replace("\n", "<br />")), null, MediaTypeNames.Text.Html);
                        }
                        using (StreamReader sr = new StreamReader(msg.AlternateViews[1].ContentStream)) {
                            msg.AlternateViews[1] = AlternateView.CreateAlternateViewFromString(sr.ReadToEnd().Replace("{Recipients}", addrs.ToString()).Replace("{Business}", reason.ToString()).Replace("{Comments}", Comments.ToString()), null, MediaTypeNames.Text.Plain);
                        }
                    }
                }

                if (hasAddress)
                {
                    msg.Send();
                }
            } catch (Exception ex) {
            } finally {
                if (msg != null)
                {
                    msg.Dispose();
                    msg = null;
                }
            }
        }
예제 #19
0
        private void ly_material_plan_mainDataGridView_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView dgv = sender as DataGridView;

            if (null == dgv.CurrentRow)
            {
                return;
            }



            if ("plan_approve_two" == dgv.CurrentCell.OwningColumn.Name)
            {
                if (!string.IsNullOrEmpty(dgv.CurrentRow.Cells["plan_approve_people_two"].Value.ToString()))
                {
                    if (dgv.CurrentRow.Cells["plan_approve_people_two"].Value.ToString() != SQLDatabase.nowUserName())
                    {
                        MessageBox.Show("请" + dgv.CurrentRow.Cells["plan_approve_people_two"].Value.ToString() + "修改...", "注意");

                        return;
                    }
                }


                if ("True" == dgv.CurrentRow.Cells["plan_approve_two"].Value.ToString())
                {
                    dgv.CurrentRow.Cells["plan_approve_two"].Value = "False";

                    dgv.CurrentRow.Cells["plan_approve_people_two"].Value = DBNull.Value;
                    dgv.CurrentRow.Cells["plan_approve_date_two"].Value   = DBNull.Value;
                }
                else
                {
                    dgv.CurrentRow.Cells["plan_approve_two"].Value = "True";

                    dgv.CurrentRow.Cells["plan_approve_people_two"].Value = SQLDatabase.nowUserName();
                    dgv.CurrentRow.Cells["plan_approve_date_two"].Value   = SQLDatabase.GetNowdate();
                }


                this.ly_material_plan_mainDataGridView.EndEdit();
                this.ly_material_plan_mainBindingSource.EndEdit();

                this.ly_material_plan_mainTableAdapter.Update(this.lYPlanMange.ly_material_plan_main);



                return;
            }
        }
예제 #20
0
        public static void SendFeedbackNotifications(HttpServerUtility server, string feedbackUID, bool toGuest)
        {
            SQLDatabase  sql          = new SQLDatabase();    sql.CommandTimeout = 120;
            SQLParamList sqlParams    = new SQLParamList().Add("GUID", feedbackUID);
            DataSet      ds           = sql.ExecStoredProcedureDataSet("spFeedback_GetItem", sqlParams);
            string       GCCPortalUrl = ConfigurationManager.AppSettings["GCCPortalURL"].ToString();

            if (!sql.HasError && ds.Tables[0].Rows.Count > 0)
            {
                DataRow fbkDR = ds.Tables[0].Rows[0];
                GCCPropertyShortCode property   = (GCCPropertyShortCode)fbkDR["PropertyID"].ToString().StringToInt();
                SurveyType           surveyType = (SurveyType)fbkDR["SurveyTypeID"].ToString().StringToInt();
                NotificationReason   reason     = (NotificationReason)fbkDR["ReasonID"].ToString().StringToInt();

                string emailAddress = String.Empty;
                if (toGuest)
                {
                    if (ds.Tables[2].Columns.Contains("ContactEmail"))
                    {
                        emailAddress = ds.Tables[2].Rows[0]["ContactEmail"].ToString();
                    }
                    if (String.IsNullOrWhiteSpace(emailAddress) && ds.Tables[2].Columns.Contains("Email"))
                    {
                        emailAddress = ds.Tables[2].Rows[0]["Email"].ToString();
                    }
                    if (String.IsNullOrWhiteSpace(emailAddress) && ds.Tables[2].Columns.Contains("Q5Email"))
                    {
                        emailAddress = ds.Tables[2].Rows[0]["Q5Email"].ToString();
                    }
                    if (String.IsNullOrWhiteSpace(emailAddress))
                    {
                        //Nothing to do
                        return;
                    }
                }

                string template = String.Empty;
                string title    = String.Empty;
                object replacementModel;

                title = PropertyTools.GetCasinoName((int)property) + " - Feedback Reply Notification";
                if (toGuest)
                {
                    template         = "GuestFeedbackNotification";
                    replacementModel = new {
                        CasinoName  = PropertyTools.GetCasinoName((int)property),
                        Link        = GCCPortalUrl + "F/" + feedbackUID,
                        Attachments = new SurveyTools.SurveyAttachmentDetails[] {
                            new SurveyTools.SurveyAttachmentDetails()
                            {
                                Path = "~/Images/headers/" + PropertyTools.GetCasinoHeaderImage(property), ContentID = "HeaderImage"
                            }
                        }
                    };
                }
                else
                {
                    template         = "StaffFeedbackNotification";
                    replacementModel = new {
                        Date       = DateTime.Now.ToString("yyyy-MM-dd"),
                        CasinoName = PropertyTools.GetCasinoName((int)property),
                        Link       = GCCPortalUrl + "Admin/Feedback/" + feedbackUID
                    };
                }

                MailMessage msg = null;
                try {
                    string path = server.MapPath("~/Content/notifications/");
                    msg = EmailManager.CreateEmailFromTemplate(
                        Path.Combine(path, template + ".htm"),
                        Path.Combine(path, template + ".txt"),
                        replacementModel);
                    PropertyInfo attachmentProp = replacementModel.GetType().GetProperty("Attachments");
                    if (attachmentProp != null)
                    {
                        SurveyAttachmentDetails[] attachments = attachmentProp.GetValue(replacementModel) as SurveyAttachmentDetails[];
                        foreach (SurveyAttachmentDetails att in attachments)
                        {
                            LinkedResource lr = new LinkedResource(server.MapPath(att.Path));
                            lr.ContentId = att.ContentID;
                            msg.AlternateViews[0].LinkedResources.Add(lr);
                        }
                    }
                    msg.From    = new MailAddress("*****@*****.**");
                    msg.Subject = title;
                    bool hasAddress = false;
                    if (!String.IsNullOrWhiteSpace(emailAddress))
                    {
                        msg.To.Add(emailAddress);
                        hasAddress = true;
                    }
                    else
                    {
                        sql = new SQLDatabase();
                        DataTable dt = sql.QueryDataTable(@"
SELECT [SendType], u.[FirstName], u.[LastName],  u.[Email]
FROM [tblNotificationUsers] ne
	INNER JOIN [tblNotificationPropertySurveyReason] psr
		ON ne.[PropertySurveyReasonID] = psr.[PropertySurveyReasonID]
	INNER JOIN [tblCOM_Users] u
		ON ne.UserID = u.UserID
WHERE psr.PropertyID = @PropertyID
	AND psr.SurveyTypeID = @SurveyID
	AND psr.ReasonID = @ReasonID
;",
                                                          new SQLParamList()
                                                          .Add("@PropertyID", (int)property)
                                                          .Add("@SurveyID", (int)surveyType)
                                                          .Add("@ReasonID", (int)reason)
                                                          );
                        if (!sql.HasError && dt.Rows.Count > 0)
                        {
                            StringBuilder addrs = new StringBuilder();
                            foreach (DataRow dr in dt.Rows)
                            {
                                switch (dr["SendType"].ToString())
                                {
                                case "1":
                                    msg.To.Add(dr["Email"].ToString());
                                    addrs.Append(dr["FirstName"].ToString() + " " + dr["LastName"].ToString() + " <" + dr["Email"].ToString() + ">" + "\n");
                                    hasAddress = true;
                                    break;

                                case "2":
                                    msg.CC.Add(dr["Email"].ToString());
                                    //Colin requested that CC addresses not show on the call Aug 10,2015
                                    //addrs.Append( dr["FirstName"].ToString() + " " + dr["LastName"].ToString() + " <" + dr["Email"].ToString() + ">" + "\n" );
                                    hasAddress = true;
                                    break;

                                case "3":
                                    msg.Bcc.Add(dr["Email"].ToString());
                                    hasAddress = true;
                                    break;
                                }
                            }
                            using (StreamReader sr = new StreamReader(msg.AlternateViews[0].ContentStream))
                            {
                                msg.AlternateViews[0] = AlternateView.CreateAlternateViewFromString(sr.ReadToEnd().Replace("{Recipients}", server.HtmlEncode(addrs.ToString()).Replace("\n", "<br />")), null, MediaTypeNames.Text.Html);
                            }
                            using (StreamReader sr = new StreamReader(msg.AlternateViews[1].ContentStream))
                            {
                                msg.AlternateViews[1] = AlternateView.CreateAlternateViewFromString(sr.ReadToEnd().Replace("{Recipients}", addrs.ToString()), null, MediaTypeNames.Text.Plain);
                            }



                            //using (StreamReader sr = new StreamReader(msg.AlternateViews[0].ContentStream))
                            //{
                            //    msg.AlternateViews[0] = AlternateView.CreateAlternateViewFromString(sr.ReadToEnd().Replace("{Recipients}", server.HtmlEncode(addrs.ToString()).Replace("\n", "<br />")).Replace("{Business}", server.HtmlEncode(reason.ToString()).Replace("\n", "<br />")).Replace("{Comments}", server.HtmlEncode(Comments.ToString()).Replace("\n", "<br />")), null, MediaTypeNames.Text.Html);
                            //}
                            //using (StreamReader sr = new StreamReader(msg.AlternateViews[1].ContentStream))
                            //{
                            //    msg.AlternateViews[1] = AlternateView.CreateAlternateViewFromString(sr.ReadToEnd().Replace("{Recipients}", addrs.ToString()).Replace("{Business}", reason.ToString()).Replace("{Comments}", Comments.ToString()), null, MediaTypeNames.Text.Plain);
                            //}
                        }
                    }

                    if (hasAddress)
                    {
                        msg.Send();
                    }
                } catch (Exception ex) {
                } finally {
                    if (msg != null)
                    {
                        msg.Dispose();
                        msg = null;
                    }
                }
            }
        }
예제 #21
0
        private void 统一制定采购员ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!SQLDatabase.CheckHaveRight(SQLDatabase.NowUserID, "物料采购员设置"))
            {
                return;
            }

            DataGridView dgv = ly_inma0010_sortDataGridView;



            string nowitemno;

            //string sel = "SELECT distinct yhbm as 代码,yhmc as 名称 FROM T_users order by yhbm";

            string    sel       = @"select yhbm as 工号, yhmc as 姓名 from T_users_Purchase_View ";
            QueryForm queryForm = new QueryForm();


            queryForm.Sel    = sel;
            queryForm.Constr = SQLDatabase.Connectstring;

            //Set the Column Collection to the filter Table
            //queryForm.SetSourceColumns(this.billMainDataSet.BalanceBill.Columns);

            queryForm.ShowDialog();

            //for (int i = 0; i < this.dataGridView1.Columns.Count; i++)

            //    this.dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;

            dgv.Columns["采购员"].SortMode = DataGridViewColumnSortMode.NotSortable;

            NewFrm.Show(this);
            foreach (DataGridViewRow dgr in dgv.Rows)
            {
                if (true == dgr.Selected)
                {
                    nowitemno = dgr.Cells["物资编号"].Value.ToString();

                    this.itemlist.Add(nowitemno);

                    //dgr.Cells["buyer_code"].Value = queryForm.Result;
                    //dgr.Cells["采购员"].Value = queryForm.Result1;

                    NewFrm.Notify(this, "正在更新:  (" + nowitemno + ")" + "   采购员");


                    UpdateSupplier(nowitemno, queryForm.Result, queryForm.Result1);

                    //this.ly_inma0010_sortBindingSource.EndEdit();

                    //this.ly_inma0010_sortTableAdapter.Update(this.lYMaterielRequirements.ly_inma0010_sort);


                    //UpdateRequirement(itemno, nowid, "buyercode", queryForm.Result);

                    //this.ly_inma0010_sortBindingSource.EndEdit();

                    //this.ly_inma0010_sortTableAdapter.Update(this.lYMaterielRequirements.ly_inma0010_sort);
                }
            }

            dgv.Columns["采购员"].SortMode = DataGridViewColumnSortMode.Automatic;
            // this.lY_MaterielRequirementsTableAdapter.Fill(this.lYPlanMange.LY_MaterielRequirements, parentId, "外协", "OWE");
            this.ly_inma0010_sortTableAdapter.Fill(this.lYMaterielRequirements.ly_inma0010_sort, this.sortcode, this.sortcode);
            NewFrm.Hide(this);

            int nowindex = 0;

            foreach (string nowitem in itemlist)
            {
                nowindex = this.ly_inma0010_sortBindingSource.Find("物资编号", nowitem);
                dgv.Rows[nowindex].Selected = true;
            }



            // dgv.Columns["采购员"].SortMode = DataGridViewColumnSortMode.Automatic;
        }
예제 #22
0
        private void ly_purchase_contract_mainDataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            foreach (DataGridViewRow dgr in ly_purchase_contract_detailDataGridView.Rows)
            {
                if (string.IsNullOrEmpty(dgr.Cells["合同单价"].Value.ToString().Replace(" ", "")))
                {
                    MessageBox.Show("合同明细中存在无单价条目,不能通过...", "注意");
                    return;
                }
            }

            DataGridView dgv = sender as DataGridView;


            ///////////////////////////////////////////////////////////
            if ("审定" == dgv.CurrentCell.OwningColumn.Name)
            {
                string nowcontractcode = dgv.CurrentRow.Cells["合同编号"].Value.ToString();


                if ("True" == dgv.CurrentRow.Cells["审定"].Value.ToString())
                {
                    if (SQLDatabase.updatePurchaseContractmain(nowcontractcode, "审定", "0", DBNull.Value.ToString()))
                    {
                        dgv.CurrentRow.Cells["审定"].Value  = "False";
                        dgv.CurrentRow.Cells["审定人"].Value = DBNull.Value;
                    }
                }
                else
                {
                    if (SQLDatabase.updatePurchaseContractmain(nowcontractcode, "审定", "1", SQLDatabase.nowUserName()))
                    {
                        dgv.CurrentRow.Cells["审定"].Value  = "True";
                        dgv.CurrentRow.Cells["审定人"].Value = SQLDatabase.nowUserName();
                    }
                }



                //SaveContract();



                return;
            }
            ///////////////////////////////////////////////////////////

            /////////////////////////////////////////////////////////////
            //if ("审核" == dgv.CurrentCell.OwningColumn.Name)
            //{

            //    if ("True" == dgv.CurrentRow.Cells["审核"].Value.ToString())
            //    {
            //        dgv.CurrentRow.Cells["审核"].Value = "False";
            //        dgv.CurrentRow.Cells["审核人"].Value = DBNull.Value;

            //    }
            //    else
            //    {

            //        dgv.CurrentRow.Cells["审核"].Value = "True";
            //        dgv.CurrentRow.Cells["审核人"].Value = SQLDatabase.nowUserName();
            //    }



            //    SaveContract();



            //    return;

            //}
            ///////////////////////////////////////////////////////////


            //int nowcontractId;
            //if (null != dgv.CurrentRow)
            //{
            //    nowcontractId = int.Parse(dgv.CurrentRow.Cells["id6"].Value.ToString());
            //}
            //else
            //{
            //    nowcontractId = 0;
            //}



            //if (null != this.ly_material_plan_mainDataGridView.CurrentRow)
            //{

            //    string planNum = this.ly_material_plan_mainDataGridView.CurrentRow.Cells["计划编号"].Value.ToString();


            //    string nowOwningColumnName = dgv.CurrentCell.OwningColumn.Name;
            //    this.ly_purchase_contract_mainTableAdapter.Fill(this.lYMaterielRequirements.ly_purchase_contract_main, planNum);

            //    this.ly_purchase_contract_mainBindingSource.Position = this.ly_purchase_contract_mainBindingSource.Find("id", nowcontractId);


            //    ly_purchase_contract_mainDataGridView.CurrentCell = ly_purchase_contract_mainDataGridView.CurrentRow.Cells[nowOwningColumnName];
            //}

            //dgv = ly_purchase_contract_mainDataGridView;

            /////////////////////////////////////////////////////////

            //if ("True" == dgv.CurrentRow.Cells["批准"].Value.ToString())
            //{
            //    MessageBox.Show("合同已经审批,不能修改数据...", "注意");
            //    return;

            //}



            //if ("签订日期" == dgv.CurrentCell.OwningColumn.Name)
            //{

            //    ChangeValue queryForm = new ChangeValue();

            //    queryForm.OldValue = dgv.CurrentCell.Value.ToString();
            //    queryForm.NewValue = "";
            //    queryForm.ChangeMode = "datetime";
            //    queryForm.ShowDialog();



            //    if (queryForm.NewValue != "")
            //    {
            //        dgv.CurrentRow.Cells["签订日期"].Value = queryForm.NewValue;
            //        //dgv.CurrentRow.Cells["discount_money"].Value = DBNull.Value;

            //        //dgv.CurrentRow.Cells["approve_flag"].Value = "False";
            //        SaveContract();


            //        //CountPlanStru();

            //    }
            //    else
            //    {


            //    }
            //    return;

            //}

            ///////////////////////////////
            //if ("备注说明" == dgv.CurrentCell.OwningColumn.Name)
            //{

            //    ChangeValue queryForm = new ChangeValue();

            //    queryForm.OldValue = dgv.CurrentCell.Value.ToString();
            //    queryForm.NewValue = "";
            //    queryForm.ChangeMode = "longstring";
            //    queryForm.ShowDialog();



            //    if (queryForm.NewValue != "")
            //    {
            //        dgv.CurrentRow.Cells["备注说明"].Value = queryForm.NewValue;
            //        //dgv.CurrentRow.Cells["discount_money"].Value = DBNull.Value;

            //        //dgv.CurrentRow.Cells["approve_flag"].Value = "False";
            //        SaveContract();

            //        //CountPlanStru();

            //    }
            //    else
            //    {

            //    }
            //    return;

            //}

            /////////////////////////////////////////////////////////////
            //if ("供方合同号" == dgv.CurrentCell.OwningColumn.Name)
            //{

            //    ChangeValue queryForm = new ChangeValue();

            //    queryForm.OldValue = dgv.CurrentCell.Value.ToString();
            //    queryForm.NewValue = "";
            //    queryForm.ChangeMode = "string";
            //    queryForm.ShowDialog();



            //    if (queryForm.NewValue != "")
            //    {
            //        dgv.CurrentRow.Cells["供方合同号"].Value = queryForm.NewValue;
            //        //dgv.CurrentRow.Cells["discount_money"].Value = DBNull.Value;

            //        //dgv.CurrentRow.Cells["approve_flag"].Value = "False";
            //        SaveContract();

            //        //CountPlanStru();

            //    }
            //    else
            //    {

            //    }
            //    return;

            //}

            /////////////////////////////////////////////////////////////
            //if ("提交" == dgv.CurrentCell.OwningColumn.Name)
            //{

            //    if ("True" == dgv.CurrentRow.Cells["提交"].Value.ToString())
            //    {
            //        dgv.CurrentRow.Cells["提交"].Value = "False";

            //    }
            //    else
            //    {

            //        dgv.CurrentRow.Cells["提交"].Value = "True";
            //    }



            //    SaveContract();



            //    return;

            //}
            /////////////////////////////////////////////////////////////
        }
예제 #23
0
        private void ly_materiel_supplier_MOQDataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            DataGridView dgv = sender as DataGridView;

            if (null == dgv.CurrentRow)
            {
                return;
            }


            //if ("True" == dgv.CurrentRow.Cells["审批"].Value.ToString())
            //{
            //    MessageBox.Show("依赖书已经生产审批,不能修改数据...", "注意");
            //    return;

            //}



            if ("起订量" == dgv.CurrentCell.OwningColumn.Name)
            {
                if ("True" == dgv.CurrentRow.Cells["审批"].Value.ToString())
                {
                    MessageBox.Show("已经批准,不能修改数据...", "注意");
                    return;
                }

                ChangeValue queryForm = new ChangeValue();

                queryForm.OldValue   = dgv.CurrentCell.Value.ToString();
                queryForm.NewValue   = "";
                queryForm.ChangeMode = "value";
                queryForm.ShowDialog();



                if (queryForm.NewValue != "")
                {
                    dgv.CurrentRow.Cells["起订量"].Value = queryForm.NewValue;


                    //dgv.CurrentRow.Cells["discount_money"].Value = DBNull.Value;

                    //dgv.CurrentRow.Cells["approve_flag"].Value = "False";ly_plan_getmaterialDataGridView
                }
                else
                {
                    //hT_Manage_ItemDataGridView.CurrentRow.Cells["apply_money"].Value = queryForm.NewValue;
                    dgv.CurrentRow.Cells["起订量"].Value = DBNull.Value;
                    //dgv.CurrentRow.Cells["apply_money"].Value = DBNull.Value;
                    //dgv.CurrentRow.Cells["approve_flag"].Value = "False";
                    //SaveChanged();
                }

                SaveMOQ();
                return;
            }



            ///////////////////////////////////////////////////////////////

            if ("单价MOQ" == dgv.CurrentCell.OwningColumn.Name)
            {
                if ("True" == dgv.CurrentRow.Cells["审批"].Value.ToString())
                {
                    MessageBox.Show("已经批准,不能修改数据...", "注意");
                    return;
                }

                ChangeValue queryForm = new ChangeValue();

                queryForm.OldValue   = dgv.CurrentCell.Value.ToString();
                queryForm.NewValue   = "";
                queryForm.ChangeMode = "value";
                queryForm.ShowDialog();



                if (queryForm.NewValue != "")
                {
                    dgv.CurrentRow.Cells["单价MOQ"].Value = queryForm.NewValue;


                    //dgv.CurrentRow.Cells["discount_money"].Value = DBNull.Value;

                    //dgv.CurrentRow.Cells["approve_flag"].Value = "False";ly_plan_getmaterialDataGridView
                }
                else
                {
                    dgv.CurrentRow.Cells["单价MOQ"].Value = DBNull.Value;
                    //hT_Manage_ItemDataGridView.CurrentRow.Cells["apply_money"].Value = queryForm.NewValue;
                    //dgv.CurrentRow.Cells["discount_money"].Value = DBNull.Value;
                    //dgv.CurrentRow.Cells["apply_money"].Value = DBNull.Value;
                    //dgv.CurrentRow.Cells["approve_flag"].Value = "False";
                    //SaveChanged();
                }

                SaveMOQ();
                return;
            }



            ///////////////////////////////////////////////////////////////
            if ("提前期MOQ" == dgv.CurrentCell.OwningColumn.Name)
            {
                if ("True" == dgv.CurrentRow.Cells["审批"].Value.ToString())
                {
                    MessageBox.Show("已经批准,不能修改数据...", "注意");
                    return;
                }

                ChangeValue queryForm = new ChangeValue();

                queryForm.OldValue   = dgv.CurrentCell.Value.ToString();
                queryForm.NewValue   = "";
                queryForm.ChangeMode = "value";
                queryForm.ShowDialog();



                if (queryForm.NewValue != "")
                {
                    dgv.CurrentRow.Cells["提前期MOQ"].Value = queryForm.NewValue;


                    //dgv.CurrentRow.Cells["discount_money"].Value = DBNull.Value;

                    //dgv.CurrentRow.Cells["approve_flag"].Value = "False";ly_plan_getmaterialDataGridView
                }
                else
                {
                    //hT_Manage_ItemDataGridView.CurrentRow.Cells["apply_money"].Value = queryForm.NewValue;
                    dgv.CurrentRow.Cells["提前期MOQ"].Value = DBNull.Value;
                    //dgv.CurrentRow.Cells["apply_money"].Value = DBNull.Value;
                    //dgv.CurrentRow.Cells["approve_flag"].Value = "False";
                    //SaveChanged();
                }

                SaveMOQ();
                return;
            }



            ///////////////////////////////////////////////////////////////


            ////////////////////////////////////////////////////////////////////////

            /////////////////////////////
            if ("备注MOQ" == dgv.CurrentCell.OwningColumn.Name)
            {
                if ("True" == dgv.CurrentRow.Cells["审批"].Value.ToString())
                {
                    MessageBox.Show("已经批准,不能修改数据...", "注意");
                    return;
                }


                ChangeValue queryForm = new ChangeValue();

                queryForm.OldValue   = dgv.CurrentCell.Value.ToString();
                queryForm.NewValue   = "";
                queryForm.ChangeMode = "longstring";
                queryForm.ShowDialog();



                if (queryForm.NewValue != "")
                {
                    dgv.CurrentRow.Cells["备注MOQ"].Value = queryForm.NewValue;
                }
                else
                {
                    dgv.CurrentRow.Cells["备注MOQ"].Value = DBNull.Value;
                }
                SaveMOQ();

                return;
            }
            /////////////////////////////////////////////////////////////////

            if ("审批" == dgv.CurrentCell.OwningColumn.Name)
            {
                if (!SQLDatabase.CheckHaveRight(SQLDatabase.NowUserID, "MOQ审批"))
                {
                    MessageBox.Show("无MOQ审批权限,操作取消...", "注意");
                    return;
                }


                if ("True" == dgv.CurrentRow.Cells["审批"].Value.ToString())
                {
                    dgv.CurrentRow.Cells["审批"].Value = "False";

                    dgv.CurrentRow.Cells["审批人"].Value  = DBNull.Value;
                    dgv.CurrentRow.Cells["审批日期"].Value = DBNull.Value;
                }
                else
                {
                    dgv.CurrentRow.Cells["审批"].Value = "True";

                    dgv.CurrentRow.Cells["审批人"].Value  = SQLDatabase.nowUserName();
                    dgv.CurrentRow.Cells["审批日期"].Value = SQLDatabase.GetNowdate();
                }


                SaveMOQ();



                return;
            }
            ////////////////////////////////////////////////////////////////////////
            /////////////////////////////////
            ////if ("质检意见" == dgv.CurrentCell.OwningColumn.Name)
            ////{

            ////    ChangeValue queryForm = new ChangeValue();

            ////    queryForm.OldValue = dgv.CurrentCell.Value.ToString();
            ////    queryForm.NewValue = "";
            ////    queryForm.ChangeMode = "longstring";
            ////    queryForm.ShowDialog();



            ////    if (queryForm.NewValue != "")
            ////    {
            ////        dgv.CurrentRow.Cells["质检意见"].Value = queryForm.NewValue;


            ////    }
            ////    else
            ////    {
            ////        dgv.CurrentRow.Cells["质检意见"].Value = DBNull.Value;

            ////    }

            ////    SaveDetail();
            ////    return;

            ////}
            /////////////////////////////////////////////////////////////////////

            ///////////////////////////////////////////////////////////////////////////////
            //if ("维修日期" == dgv.CurrentCell.OwningColumn.Name)
            //{

            //    //if ("True" == dgv.CurrentRow.Cells["已交"].Value.ToString())
            //    //{
            //    //    MessageBox.Show("合同文本已经提交,不能修改交付日期...", "注意");

            //    //    return;
            //    //}

            //    ChangeValue queryForm = new ChangeValue();

            //    queryForm.OldValue = dgv.CurrentCell.Value.ToString();
            //    queryForm.NewValue = "";
            //    queryForm.ChangeMode = "datetime";
            //    queryForm.ShowDialog();


            //    if (queryForm.NewValue != "")
            //    {
            //        dgv.CurrentRow.Cells["维修日期"].Value = queryForm.NewValue;


            //    }
            //    else
            //    {

            //        dgv.CurrentRow.Cells["维修日期"].Value = DBNull.Value;


            //    }



            //    SaveDetail();



            //    return;

            //}
        }
예제 #24
0
        private void 批量所选绑定发票ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //MessageBox.Show("正在开发中", "注意");
            //return;
            DataGridView dgv = lY_Invoice_Instore_BindlistDataGridView;

            if (dgv.CurrentRow == null || null == ly_fpDataGridView.CurrentRow)
            {
                return;
            }
            string salespeople = this.ly_fpDataGridView.CurrentRow.Cells["录入人"].Value.ToString();

            if (!string.IsNullOrEmpty(salespeople))
            {
                if (salespeople != SQLDatabase.nowUserName())
                {
                    MessageBox.Show("请录入人:" + salespeople + "操作", "注意");
                    return;
                }
            }
            if (ly_fpDataGridView.CurrentRow.Cells["lock_flag"].Value.ToString() == "True")
            {
                MessageBox.Show("已经锁定无法操作...", "注意");
                return;
            }
            if ("True" == ly_fpDataGridView.CurrentRow.Cells["提交"].Value.ToString())
            {
                MessageBox.Show("已经提交无法操作...", "注意");
                return;
            }
            foreach (DataGridViewRow dgr in dgv.Rows)
            {
                if (true == dgr.Selected)
                {
                    string fpid = ly_fpDataGridView.CurrentRow.Cells["id_main"].Value.ToString();

                    decimal fp_money      = decimal.Parse(ly_fpDataGridView.CurrentRow.Cells["invoice_money_novat"].Value.ToString());
                    decimal no_bind_moeny = decimal.Parse(dgr.Cells["notbind_money_novat"].Value.ToString() == "" ? "0" : dgr.Cells["notbind_money_novat"].Value.ToString());

                    string  store_id = dgr.Cells["store_id"].Value.ToString();
                    decimal qty_in   = decimal.Parse(dgr.Cells["qty_in"].Value.ToString() == "" ? "0" : dgr.Cells["qty_in"].Value.ToString());
                    decimal bind_qty = decimal.Parse(dgr.Cells["bind_qty"].Value.ToString() == "" ? "0" : dgr.Cells["bind_qty"].Value.ToString());
                    if (bind_qty > 0)
                    {
                        break;
                    }

                    for (int i = 0; i < ly_invoice_detailDataGridView.Rows.Count; i++)
                    {
                        if (ly_invoice_detailDataGridView.Rows[i].Cells["instore_id0"].Value.ToString() == store_id)
                        {
                            MessageBox.Show("该入库单已经有绑定记录,请直接修改绑定数量...", "注意");
                            break;
                        }
                    }

                    decimal bind_now_qty = qty_in - bind_qty;
                    if (bind_now_qty <= 0)
                    {
                        MessageBox.Show("该入库单绑定数量已经超过真实数量...", "注意");
                        break;
                    }
                    decimal sumBindmoney = 0;
                    for (int i = 0; i < ly_invoice_detailDataGridView.Rows.Count; i++)
                    {
                        sumBindmoney += decimal.Parse(ly_invoice_detailDataGridView.Rows[i].Cells["bind_money_novat2"].Value.ToString() == "" ? "0.00" : ly_invoice_detailDataGridView.Rows[i].Cells["bind_money_novat2"].Value.ToString());
                    }
                    this.lyinvoicedetailNewBindingSource.AddNew();

                    this.ly_invoice_detailDataGridView.CurrentRow.Cells["invoice_id0"].Value = fpid;
                    this.ly_invoice_detailDataGridView.CurrentRow.Cells["instore_id0"].Value = store_id;
                    this.ly_invoice_detailDataGridView.CurrentRow.Cells["bind_qty0"].Value   = bind_now_qty;

                    decimal bind_additional_fee = decimal.Parse(
                        string.IsNullOrEmpty(dgr.Cells["additional_fee_Notbind"].Value.ToString()) == true ? "0.00" :
                        dgr.Cells["additional_fee_Notbind"].Value.ToString()
                        );

                    this.ly_invoice_detailDataGridView.CurrentRow.Cells["bind_additional_fee"].Value = bind_additional_fee;
                    this.ly_invoice_detailDataGridView.EndEdit();
                    this.lyinvoicedetailNewBindingSource.EndEdit();
                    this.ly_invoice_detail_NewTableAdapter.Update(this.lYStoreMange.ly_invoice_detail_New);
                }
            }
            int id_main = int.Parse(this.ly_fpDataGridView.CurrentRow.Cells["id_main"].Value.ToString());

            loadData();
            lyinvoiceBindingSource.Position = lyinvoiceBindingSource.Find("id", id_main);
            string supplier_code = this.ly_fpDataGridView.CurrentRow.Cells["客户编码"].Value.ToString();

            this.ly_invoice_detail_NewTableAdapter.Fill(this.lYStoreMange.ly_invoice_detail_New, id_main, supplier_code);
            this.lY_Invoice_Instore_BindlistTableAdapter.Fill(this.lYStoreMange.LY_Invoice_Instore_Bindlist, supplier_code, "");
        }
예제 #25
0
        private static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            // Read config options
            string[]       filters          = null;
            string[]       ignoreFilters    = null;
            bool           sqlOutput        = false;
            DumpFormatType dumpFormat       = DumpFormatType.Text;
            int            packetsToRead    = 0; // 0 -> All packets
            int            packetNumberLow  = 0; // 0 -> No low limit
            int            packetNumberHigh = 0; // 0 -> No high limit
            bool           prompt           = false;
            int            threads          = 0;

            try
            {
                ClientVersion.SetVersion(Settings.GetEnum <ClientVersionBuild>("ClientBuild"));

                packetNumberLow  = Settings.GetInt32("FilterPacketNumLow");
                packetNumberHigh = Settings.GetInt32("FilterPacketNumHigh");

                if (packetNumberLow > 0 && packetNumberHigh > 0 && packetNumberLow > packetNumberHigh)
                {
                    throw new Exception("FilterPacketNumLow must be less or equal than FilterPacketNumHigh");
                }

                string filtersString = Settings.GetString("Filters");
                if (filtersString != null)
                {
                    filters = filtersString.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                }

                filtersString = Settings.GetString("IgnoreFilters");
                if (filtersString != null)
                {
                    ignoreFilters = filtersString.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                }

                sqlOutput     = Settings.GetBoolean("SQLOutput");
                dumpFormat    = (DumpFormatType)Settings.GetInt32("DumpFormat");
                packetsToRead = Settings.GetInt32("PacketsNum");
                prompt        = Settings.GetBoolean("ShowEndPrompt");
                threads       = Settings.GetInt32("Threads");

                // Disable DB and DBCs when we don't need its data (dumping to a binary file)
                if (dumpFormat == DumpFormatType.Bin || dumpFormat == DumpFormatType.Pkt)
                {
                    DBCStore.Enabled     = false;
                    SQLConnector.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.GetType());
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
            }

            // Quit if no arguments are given
            if (args.Length == 0)
            {
                Console.WriteLine("No files specified.");
                EndPrompt(prompt);
                return;
            }

            // Read DBCs
            if (DBCStore.Enabled)
            {
                var startTime = DateTime.Now;
                Console.WriteLine("Loading DBCs...");

                new DBCLoader();

                var endTime = DateTime.Now;
                var span    = endTime.Subtract(startTime);
                Console.WriteLine("Finished loading DBCs - {0} Minutes, {1} Seconds and {2} Milliseconds.", span.Minutes, span.Seconds, span.Milliseconds);
                Console.WriteLine();
            }

            // Read DB
            if (SQLConnector.Enabled)
            {
                var startTime = DateTime.Now;
                Console.WriteLine("Loading DB...");

                try
                {
                    SQLConnector.Connect();
                    SQLDatabase.GrabData();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    SQLConnector.Enabled = false; // Something failed, disabling everything SQL related
                }

                var endTime = DateTime.Now;
                var span    = endTime.Subtract(startTime);
                Console.WriteLine("Finished loading DB - {0} Minutes, {1} Seconds and {2} Milliseconds.", span.Minutes, span.Seconds, span.Milliseconds);
                Console.WriteLine();
            }

            // Read binaries
            string[] files = args;
            if (args.Length == 1 && args[0].Contains('*'))
            {
                try
                {
                    files = Directory.GetFiles(@".\", args[0]);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.GetType());
                    Console.WriteLine(ex.Message);
                    Console.WriteLine(ex.StackTrace);
                }
            }

            if (threads == 0) // Number of threads is automatically choosen by the Parallel library
            {
                files.AsParallel().SetCulture().ForAll(file => ReadFile(file, filters, ignoreFilters, packetNumberLow, packetNumberHigh, packetsToRead, dumpFormat, threads, sqlOutput, prompt));
            }
            else
            {
                files.AsParallel().SetCulture().WithDegreeOfParallelism(threads).ForAll(file => ReadFile(file, filters, ignoreFilters, packetNumberLow, packetNumberHigh, packetsToRead, dumpFormat, threads, sqlOutput, prompt));
            }
        }
예제 #26
0
        private void lY_Invoice_Instore_BindlistDataGridView_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (lY_Invoice_Instore_BindlistDataGridView.CurrentRow == null || null == ly_fpDataGridView.CurrentRow)
            {
                return;
            }
            string salespeople = this.ly_fpDataGridView.CurrentRow.Cells["录入人"].Value.ToString();

            if (!string.IsNullOrEmpty(salespeople))
            {
                if (salespeople != SQLDatabase.nowUserName())
                {
                    MessageBox.Show("请录入人:" + salespeople + "操作", "注意");
                    return;
                }
            }
            if (ly_fpDataGridView.CurrentRow.Cells["lock_flag"].Value.ToString() == "True")
            {
                MessageBox.Show("已经锁定无法操作...", "注意");
                return;
            }
            if ("True" == ly_fpDataGridView.CurrentRow.Cells["提交"].Value.ToString())
            {
                MessageBox.Show("已经提交无法操作...", "注意");
                return;
            }

            if (!string.IsNullOrEmpty(ly_fpDataGridView.CurrentRow.Cells["税率"].Value.ToString()) &&
                !string.IsNullOrEmpty(lY_Invoice_Instore_BindlistDataGridView.CurrentRow.Cells["税率1"].Value.ToString()))
            {
                if (decimal.Parse(ly_fpDataGridView.CurrentRow.Cells["税率"].Value.ToString()) - decimal.Parse(lY_Invoice_Instore_BindlistDataGridView.CurrentRow.Cells["税率1"].Value.ToString()) < 0 ||
                    decimal.Parse(ly_fpDataGridView.CurrentRow.Cells["税率"].Value.ToString()) - decimal.Parse(lY_Invoice_Instore_BindlistDataGridView.CurrentRow.Cells["税率1"].Value.ToString()) > 0)
                {
                    string            caption = "提示...";
                    MessageBoxButtons buttons = MessageBoxButtons.YesNo;

                    DialogResult result;

                    string message = "合同税率与发票税率不一致,确定要继续绑定吗";

                    result = MessageBox.Show(message, caption, buttons,
                                             MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

                    if (result == DialogResult.Yes)
                    {
                    }
                    else
                    {
                        return;
                    }
                }
            }
            if (lY_Invoice_Instore_BindlistDataGridView.CurrentRow.Cells["账期"].Value.ToString() == "")
            {
                string            caption = "提示...";
                MessageBoxButtons buttons = MessageBoxButtons.YesNo;

                DialogResult result;

                string message = "该合同的账期为空,确定要继续绑定吗";

                result = MessageBox.Show(message, caption, buttons,
                                         MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

                if (result == DialogResult.Yes)
                {
                }
                else
                {
                    return;
                }
            }

            string fpid = ly_fpDataGridView.CurrentRow.Cells["id_main"].Value.ToString();
            //2019-04-09
            //decimal fp_money = decimal.Parse(ly_fpDataGridView.CurrentRow.Cells["发票金额"].Value.ToString());
            //decimal no_bind_moeny = decimal.Parse(lY_Invoice_Instore_BindlistDataGridView.CurrentRow.Cells["notbind_money"].Value.ToString() == "" ? "0" : lY_Invoice_Instore_BindlistDataGridView.CurrentRow.Cells["notbind_money"].Value.ToString());

            //20190409新增
            decimal fp_money      = decimal.Parse(ly_fpDataGridView.CurrentRow.Cells["invoice_money_novat"].Value.ToString());
            decimal no_bind_moeny = decimal.Parse(lY_Invoice_Instore_BindlistDataGridView.CurrentRow.Cells["notbind_money_novat"].Value.ToString() == "" ? "0" : lY_Invoice_Instore_BindlistDataGridView.CurrentRow.Cells["notbind_money_novat"].Value.ToString());

            //
            string  store_id = lY_Invoice_Instore_BindlistDataGridView.CurrentRow.Cells["store_id"].Value.ToString();
            decimal qty_in   = decimal.Parse(lY_Invoice_Instore_BindlistDataGridView.CurrentRow.Cells["qty_in"].Value.ToString() == "" ? "0" : lY_Invoice_Instore_BindlistDataGridView.CurrentRow.Cells["qty_in"].Value.ToString());
            decimal bind_qty = decimal.Parse(lY_Invoice_Instore_BindlistDataGridView.CurrentRow.Cells["bind_qty"].Value.ToString() == "" ? "0" : lY_Invoice_Instore_BindlistDataGridView.CurrentRow.Cells["bind_qty"].Value.ToString());



            for (int i = 0; i < ly_invoice_detailDataGridView.Rows.Count; i++)
            {
                if (ly_invoice_detailDataGridView.Rows[i].Cells["instore_id0"].Value.ToString() == store_id)
                {
                    MessageBox.Show("该入库单已经有绑定记录,请直接修改绑定数量...", "注意");
                    return;
                }
            }

            //-------------------------


            decimal bind_now_qty = qty_in - bind_qty;

            if (bind_now_qty <= 0)
            {
                MessageBox.Show("该入库单绑定数量已经超过真实数量...", "注意");
                return;
            }
            decimal sumBindmoney = 0;

            for (int i = 0; i < ly_invoice_detailDataGridView.Rows.Count; i++)
            {
                //20190409
                //sumBindmoney += decimal.Parse(ly_invoice_detailDataGridView.Rows[i].Cells["bind_money"].Value.ToString() == "" ? "0.00" : ly_invoice_detailDataGridView.Rows[i].Cells["bind_money"].Value.ToString());
                sumBindmoney += decimal.Parse(ly_invoice_detailDataGridView.Rows[i].Cells["bind_money_novat2"].Value.ToString() == "" ? "0.00" : ly_invoice_detailDataGridView.Rows[i].Cells["bind_money_novat2"].Value.ToString());
            }

            //if ( Math.Round((no_bind_moeny + sumBindmoney),2) > Math.Round(fp_money,2))
            //{
            //    MessageBox.Show("绑定金额超过发票金额...", "注意");
            //    return;
            //}
            this.lyinvoicedetailNewBindingSource.AddNew();

            this.ly_invoice_detailDataGridView.CurrentRow.Cells["invoice_id0"].Value = fpid;
            this.ly_invoice_detailDataGridView.CurrentRow.Cells["instore_id0"].Value = store_id;
            this.ly_invoice_detailDataGridView.CurrentRow.Cells["bind_qty0"].Value   = bind_now_qty;

            decimal bind_additional_fee = decimal.Parse(
                string.IsNullOrEmpty(lY_Invoice_Instore_BindlistDataGridView.CurrentRow.Cells["additional_fee_Notbind"].Value.ToString()) == true ? "0.00" :
                lY_Invoice_Instore_BindlistDataGridView.CurrentRow.Cells["additional_fee_Notbind"].Value.ToString()
                );

            this.ly_invoice_detailDataGridView.CurrentRow.Cells["bind_additional_fee"].Value = bind_additional_fee;


            this.ly_invoice_detailDataGridView.EndEdit();
            this.lyinvoicedetailNewBindingSource.EndEdit();
            this.ly_invoice_detail_NewTableAdapter.Update(this.lYStoreMange.ly_invoice_detail_New);

            int id_main = int.Parse(this.ly_fpDataGridView.CurrentRow.Cells["id_main"].Value.ToString());


            loadData();
            lyinvoiceBindingSource.Position = lyinvoiceBindingSource.Find("id", id_main);

            string supplier_code = this.ly_fpDataGridView.CurrentRow.Cells["客户编码"].Value.ToString();

            this.ly_invoice_detail_NewTableAdapter.Fill(this.lYStoreMange.ly_invoice_detail_New, id_main, supplier_code);



            this.lY_Invoice_Instore_BindlistTableAdapter.Fill(this.lYStoreMange.LY_Invoice_Instore_Bindlist, supplier_code, "");

            this.lyinvoicedetailNewBindingSource.Position          = lyinvoicedetailNewBindingSource.Find("instore_id", store_id);
            this.lY_Invoice_Instore_BindlistBindingSource.Position = lY_Invoice_Instore_BindlistBindingSource.Find("id", store_id);
        }
        private void ly_production_task_inspectionDataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            DataGridView dgv = sender as DataGridView;

            if ("True" == dgv.CurrentRow.Cells["入库"].Value.ToString())
            {
                MessageBox.Show("已经入库,不能修改(实需修改,请先删除该质检单号的入库记录)", "注意");
                return;
            }

            string inspector = this.ly_production_task_inspectionDataGridView.CurrentRow.Cells["质检人"].Value.ToString();

            //if (inspector != SQLDatabase.nowUserName())
            //{
            //    MessageBox.Show("请质检员:" + inspector + "修改", "注意");
            //    return;
            //}


            if ("合格" == dgv.CurrentCell.OwningColumn.Name)
            {
                if (string.IsNullOrEmpty(dgv.CurrentRow.Cells["设备编号"].Value.ToString()))
                {
                    MessageBox.Show("无设备编号,不能设置合格标记...", "注意");
                    return;
                }


                if ("True" == dgv.CurrentRow.Cells["合格"].Value.ToString())
                {
                    dgv.CurrentRow.Cells["合格"].Value   = "False";
                    dgv.CurrentRow.Cells["质检人"].Value  = DBNull.Value;
                    dgv.CurrentRow.Cells["质检日期"].Value = DBNull.Value;
                    dgv.CurrentRow.Cells["质检单号"].Value = DBNull.Value;
                }
                else
                {
                    dgv.CurrentRow.Cells["合格"].Value   = "True";
                    dgv.CurrentRow.Cells["质检人"].Value  = SQLDatabase.nowUserName();
                    dgv.CurrentRow.Cells["质检日期"].Value = SQLDatabase.GetNowdate();
                    dgv.CurrentRow.Cells["质检单号"].Value = GetMaxTaskInspection();

                    if (!string.IsNullOrEmpty(dgv.CurrentRow.Cells["质检次数"].Value.ToString()))
                    {
                        dgv.CurrentRow.Cells["质检次数"].Value = int.Parse(dgv.CurrentRow.Cells["质检次数"].Value.ToString()) + 1;
                    }
                    else
                    {
                        dgv.CurrentRow.Cells["质检次数"].Value = 1;
                    }
                }

                SaveChanged();

                return;
            }
            if ("质检日期" == dgv.CurrentCell.OwningColumn.Name)
            {
                ChangeValue queryForm = new ChangeValue();

                queryForm.OldValue   = dgv.CurrentCell.Value.ToString();
                queryForm.NewValue   = "";
                queryForm.ChangeMode = "datetime";
                queryForm.ShowDialog();


                if (queryForm.NewValue != "")
                {
                    dgv.CurrentRow.Cells["质检日期"].Value = queryForm.NewValue;
                }
                else
                {
                    dgv.CurrentRow.Cells["质检日期"].Value = DBNull.Value;
                }

                SaveChanged();
                return;
            }

            if ("质检次数" == dgv.CurrentCell.OwningColumn.Name)
            {
                ChangeValue queryForm = new ChangeValue();

                queryForm.OldValue   = dgv.CurrentCell.Value.ToString();
                queryForm.NewValue   = "";
                queryForm.ChangeMode = "value";
                queryForm.ShowDialog();
                if (queryForm.NewValue != "")
                {
                    dgv.CurrentRow.Cells["质检次数"].Value = queryForm.NewValue;


                    if (int.Parse(queryForm.NewValue) == 1)
                    {
                        dgv.CurrentRow.Cells["初检"].Value = "True";
                    }
                    else
                    {
                        dgv.CurrentRow.Cells["初检"].Value = "False";
                    }
                }
                else
                {
                    dgv.CurrentRow.Cells["质检次数"].Value = DBNull.Value;
                    dgv.CurrentRow.Cells["初检"].Value   = "False";
                }
                SaveChanged();
                return;
            }


            if ("设备编号" == dgv.CurrentCell.OwningColumn.Name)
            {
                ChangeValue queryForm = new ChangeValue();

                queryForm.OldValue   = dgv.CurrentCell.Value.ToString();
                queryForm.NewValue   = "";
                queryForm.ChangeMode = "string";
                queryForm.ShowDialog();

                if (queryForm.NewValue != "")
                {
                    dgv.CurrentRow.Cells["设备编号"].Value = queryForm.NewValue;
                }
                else
                {
                    dgv.CurrentRow.Cells["设备编号"].Value = DBNull.Value;
                }

                SaveChanged();
                return;
            }



            if ("质检意见" == dgv.CurrentCell.OwningColumn.Name)
            {
                ChangeValue queryForm = new ChangeValue();

                queryForm.OldValue   = dgv.CurrentCell.Value.ToString();
                queryForm.NewValue   = "";
                queryForm.ChangeMode = "longstring";
                queryForm.ShowDialog();


                if (queryForm.NewValue != "")
                {
                    dgv.CurrentRow.Cells["质检意见"].Value = queryForm.NewValue;
                }
                else
                {
                    dgv.CurrentRow.Cells["质检意见"].Value = DBNull.Value;
                }

                SaveChanged();
                return;
            }
        }
예제 #28
0
        private void ly_manufacturing_procedureDataGridView_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (null == ly_fpDataGridView.CurrentRow)
            {
                return;
            }
            DataGridView dgv = sender as DataGridView;

            if (SQLDatabase.CheckHaveRight(SQLDatabase.NowUserID, "发票总管理权限"))
            {
                if ("lock_flag" == dgv.CurrentCell.OwningColumn.Name)
                {
                    if ("True" == dgv.CurrentRow.Cells["lock_flag"].Value.ToString())
                    {
                        ////----------------------
                        //string sql = "SELECT  a.contract_code, c.confirm_flag FROM ly_payable_item_detail AS a left join ly_payable_plan c on a.payable_plan_num = c.payable_plan_num WHERE  c.confirm_flag=1";
                        //DataTable dt = null;
                        //using (SqlConnection connection = new SqlConnection(SQLDatabase.Connectstring))
                        //{

                        //    SqlDataAdapter adapter = new SqlDataAdapter(sql, connection);
                        //    DataSet ds = new DataSet();
                        //    adapter.Fill(ds);
                        //    dt = ds.Tables[0];
                        //}
                        //for (int i = 0; i < dt.Rows.Count; i++)
                        //{
                        //    for (int j = 0; j < ly_invoice_detailDataGridView.Rows.Count; j++)
                        //    {
                        //        if (dt.Rows[i]["contract_code"].ToString() == ly_invoice_detailDataGridView.Rows[j].Cells["contractcode0"].Value.ToString())
                        //        {

                        //            MessageBox.Show("已有付款计划不可操作!", "注意");
                        //            return;
                        //        }

                        //    }
                        //}
                        //-------------------



                        //dgv.CurrentRow.Cells["lock_flag"].Value = "False";
                        //dgv.CurrentRow.Cells["lock_people"].Value = DBNull.Value;
                        //dgv.CurrentRow.Cells["lock_time"].Value = DBNull.Value;

                        if (SQLDatabase.CheckHaveRight(SQLDatabase.NowUserID, "采购预付付款取消"))
                        {
                            dgv.CurrentRow.Cells["lock_flag"].Value   = "False";
                            dgv.CurrentRow.Cells["lock_people"].Value = DBNull.Value;
                            dgv.CurrentRow.Cells["lock_time"].Value   = DBNull.Value;
                        }
                        else
                        {
                            MessageBox.Show("无发票锁定取消权限...", "注意");

                            return;
                        }
                    }
                    else
                    {
                        if ("False" == dgv.CurrentRow.Cells["提交"].Value.ToString() || "" == dgv.CurrentRow.Cells["提交"].Value.ToString().Trim())
                        {
                            MessageBox.Show("采购员未提交不可锁定!", "注意");
                            return;
                        }

                        if (decimal.Round(decimal.Parse(dgv.CurrentRow.Cells["invoice_money_novat"].Value.ToString().Trim()), 1)
                            <= decimal.Round(decimal.Parse(dgv.CurrentRow.Cells["bind_money_ovat"].Value.ToString().Trim()), 1)

                            ||

                            decimal.Round(decimal.Parse(dgv.CurrentRow.Cells["发票金额"].Value.ToString().Trim()), 1)
                            <= decimal.Round(decimal.Parse(dgv.CurrentRow.Cells["绑定金额"].Value.ToString().Trim()), 1)
                            )
                        {
                            if (decimal.Round(decimal.Parse(dgv.CurrentRow.Cells["bind_money_ovat"].Value.ToString().Trim()), 1) -
                                decimal.Round(decimal.Parse(dgv.CurrentRow.Cells["invoice_money_novat"].Value.ToString().Trim()), 1) > 10
                                &&
                                decimal.Round(decimal.Parse(dgv.CurrentRow.Cells["绑定金额"].Value.ToString().Trim()), 1) -
                                decimal.Round(decimal.Parse(dgv.CurrentRow.Cells["发票金额"].Value.ToString().Trim()), 1) > 10)

                            {
                                MessageBox.Show("本次发票绑定金额异常过大,请联系管理员排查!", "注意");
                                return;
                            }
                            else
                            {
                                dgv.CurrentRow.Cells["lock_flag"].Value   = "True";
                                dgv.CurrentRow.Cells["lock_people"].Value = SQLDatabase.nowUserName();
                                dgv.CurrentRow.Cells["lock_time"].Value   = SQLDatabase.GetNowtime();
                            }
                        }
                        else
                        {
                            MessageBox.Show("发票金额与绑定金额不一致!", "注意");
                            return;
                        }
                    }
                    save();
                    return;
                }
            }

            string salespeople = this.ly_fpDataGridView.CurrentRow.Cells["录入人"].Value.ToString();

            if (!string.IsNullOrEmpty(salespeople))
            {
                if (salespeople != SQLDatabase.nowUserName())
                {
                    MessageBox.Show("请录入人:" + salespeople + "修改", "注意");
                    return;
                }
            }

            //加锁
            if (ly_fpDataGridView.CurrentRow.Cells["lock_flag"].Value.ToString() == "True")
            {
                MessageBox.Show("已经锁定无法操作...", "注意");
                return;
            }

            if ("提交" == dgv.CurrentCell.OwningColumn.Name)
            {
                if ("True" == dgv.CurrentRow.Cells["提交"].Value.ToString())
                {
                    dgv.CurrentRow.Cells["提交"].Value = "False";
                    save();
                }
                else
                {
                    if (
                        //decimal.Round(decimal.Parse(dgv.CurrentRow.Cells["invoice_money_novat"].Value.ToString().Trim()),1)
                        //    <= decimal.Round(decimal.Parse(dgv.CurrentRow.Cells["bind_money_ovat"].Value.ToString().Trim()), 1)
                        //    ||

                        decimal.Round(decimal.Parse(dgv.CurrentRow.Cells["发票金额"].Value.ToString().Trim()), 2)
                        != decimal.Round(decimal.Parse(dgv.CurrentRow.Cells["绑定金额"].Value.ToString().Trim()), 2))
                    {
                        MessageBox.Show("本次发票绑定金额和发票金额不相等,请检查!", "注意");
                        return;



                        if (decimal.Round(decimal.Parse(dgv.CurrentRow.Cells["bind_money_ovat"].Value.ToString().Trim()), 1) -
                            decimal.Round(decimal.Parse(dgv.CurrentRow.Cells["invoice_money_novat"].Value.ToString().Trim()), 1) > 10
                            &&
                            decimal.Round(decimal.Parse(dgv.CurrentRow.Cells["绑定金额"].Value.ToString().Trim()), 1) -
                            decimal.Round(decimal.Parse(dgv.CurrentRow.Cells["发票金额"].Value.ToString().Trim()), 1) > 10)

                        {
                            MessageBox.Show("本次发票绑定金额异常过大,请排查!", "注意");
                            return;
                        }
                        else
                        {
                            dgv.CurrentRow.Cells["提交"].Value = "True";
                            save();
                        }
                    }
                    else
                    {
                        dgv.CurrentRow.Cells["提交"].Value = "True";
                        save();
                    }
                }
            }


            if ("录入人" == dgv.CurrentCell.OwningColumn.Name)
            {
                return;

                string    sel       = "select yhmc as 采购员 from dbo.T_users where bumen like '0004%' ";
                QueryForm queryForm = new QueryForm();
                queryForm.Sel    = sel;
                queryForm.Constr = SQLDatabase.Connectstring;
                queryForm.ShowDialog();

                if (queryForm.Result != "")
                {
                    dgv.CurrentRow.Cells["录入人"].Value = queryForm.Result;
                    save();
                }

                return;
            }


            if ("发票类别" == dgv.CurrentCell.OwningColumn.Name)
            {
                if ("True" == dgv.CurrentRow.Cells["lock_flag"].Value.ToString() || "True" == dgv.CurrentRow.Cells["提交"].Value.ToString())
                {
                    MessageBox.Show("已经提交或锁定,不能修改!", "注意");
                    return;
                }
                string    sel       = "SELECT  id as 编号, tax_type_name as 发票类型 FROM ly_tax_type  ";
                QueryForm queryForm = new QueryForm();
                queryForm.Sel    = sel;
                queryForm.Constr = SQLDatabase.Connectstring;
                queryForm.ShowDialog();

                if (queryForm.Result != "")
                {
                    dgv.CurrentRow.Cells["发票类别"].Value = queryForm.Result1;

                    save();
                }
                return;
            }

            if ("客户编码" == dgv.CurrentCell.OwningColumn.Name || "客户名称" == dgv.CurrentCell.OwningColumn.Name)
            {
                string    sel       = "select  supplier_code as 客户编码,supplier_name  客户名称  from ly_supplier_list ";
                QueryForm queryForm = new QueryForm();
                queryForm.Sel    = sel;
                queryForm.Constr = SQLDatabase.Connectstring;
                queryForm.ShowDialog();

                if (queryForm.Result != "")
                {
                    dgv.CurrentRow.Cells["客户编码"].Value = queryForm.Result;
                    dgv.CurrentRow.Cells["客户名称"].Value = queryForm.Result1;
                    save();
                }

                return;
            }
            if ("发票号码" == dgv.CurrentCell.OwningColumn.Name)
            {
                ChangeValue queryForm = new ChangeValue();

                queryForm.OldValue   = dgv.CurrentCell.Value.ToString();
                queryForm.NewValue   = "";
                queryForm.ChangeMode = "string";
                queryForm.ShowDialog();


                if (queryForm.NewValue != "")
                {
                    for (int i = 0; i < ly_fpDataGridView.Rows.Count; i++)
                    {
                        if (ly_fpDataGridView.Rows[i].Cells["发票号码"].Value.ToString() == queryForm.NewValue)
                        {
                            MessageBox.Show("该张发票已经存在", "注意");
                            return;
                        }
                    }

                    dgv.CurrentRow.Cells["发票号码"].Value = queryForm.NewValue;
                    save();
                }


                return;
            }

            if ("发票日期" == dgv.CurrentCell.OwningColumn.Name)
            {
                DatePicker queryForm = new DatePicker();


                if (null != (dgv.CurrentCell.Value))
                {
                    queryForm.NowDate = dgv.CurrentCell.Value.ToString();
                }
                else
                {
                    queryForm.NowDate = SQLDatabase.GetNowdate().Date.ToString();
                }



                queryForm.ShowDialog();
                if (!string.IsNullOrEmpty(queryForm.NowDate))
                {
                    dgv.CurrentRow.Cells["发票日期"].Value = queryForm.NowDate;
                    save();
                }
                return;
            }

            if ("发票金额" == dgv.CurrentCell.OwningColumn.Name)
            {
                ChangeValue queryForm = new ChangeValue();

                queryForm.OldValue   = dgv.CurrentCell.Value.ToString();
                queryForm.NewValue   = "";
                queryForm.ChangeMode = "value";
                queryForm.ShowDialog();


                if (queryForm.NewValue != "")
                {
                    dgv.CurrentRow.Cells["发票金额"].Value = queryForm.NewValue;
                    save();
                }
                return;
            }
            if ("税率" == dgv.CurrentCell.OwningColumn.Name)
            {
                ChangeValue queryForm = new ChangeValue();

                queryForm.OldValue   = dgv.CurrentCell.Value.ToString();
                queryForm.NewValue   = "";
                queryForm.ChangeMode = "value";
                queryForm.ShowDialog();


                if (queryForm.NewValue != "")
                {
                    dgv.CurrentRow.Cells["税率"].Value = queryForm.NewValue;
                    save();
                }
                return;
            }
        }
        private void ly_Restructuring_request_singleDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView dgv = sender as DataGridView;

            if (this.ly_Restructuring_request_singleDataGridView.CurrentRow.Cells["审批人"].Value != null)
            {
                string inspector = this.ly_Restructuring_request_singleDataGridView.CurrentRow.Cells["审批人"].Value.ToString();

                if (inspector.Trim() != "")
                {
                    if (inspector != SQLDatabase.nowUserName())
                    {
                        MessageBox.Show("请质检员:" + inspector + "修改", "注意");
                        return;
                    }
                }
            }



            if ("审批" == dgv.CurrentCell.OwningColumn.Name)
            {
                string id  = this.ly_Restructuring_request_singleDataGridView.CurrentRow.Cells["id"].Value.ToString();
                string sql = "";
                if ("True" == dgv.CurrentRow.Cells["审批"].Value.ToString())
                {
                    sql = @"update  ly_Restructuring_request_single  set   material_flag  = 0 , approve_people  =null  , approve_date  =null where  id=" + id;
                }
                else
                {
                    sql = @"update  ly_Restructuring_request_single  set   material_flag  =1 , approve_people  ='" + SQLDatabase.nowUserName() + "'  , approve_date  =GETDATE() where  id=" + id;
                }

                using (SqlConnection con = new SqlConnection(SQLDatabase.Connectstring))
                {
                    using (SqlCommand cmd = new SqlCommand(sql, con))
                    {
                        con.Open();
                        cmd.ExecuteNonQuery();
                    }
                }

                if (null != this.ly_production_orderDataGridView.CurrentRow)
                {
                    string nowproductionorderNum = this.ly_production_orderDataGridView.CurrentRow.Cells["任务单号"].Value.ToString();


                    ly_Restructuring_request_single_allTableAdapter.Fill(lYProductMange.ly_Restructuring_request_single_all, nowproductionorderNum);  //追加领料
                }
                else
                {
                    ly_Restructuring_request_single_allTableAdapter.Fill(lYProductMange.ly_Restructuring_request_single_all, "");  //追加领料
                }
                return;
            }
        }
예제 #30
0
        private void Yonghu_Load(object sender, EventArgs e)
        {
            this.nowusercode = SQLDatabase.NowUserID;


            this.ly_sales_repair_replacementTableAdapter.Connection.ConnectionString = SQLDatabase.Connectstring;

            this.ly_SalseRepair_SumQuery_ReportTableAdapter.Connection.ConnectionString = SQLDatabase.Connectstring;

            this.ly_SalseRepair_SumQuery_ReportAllTableAdapter.Connection.ConnectionString = SQLDatabase.Connectstring;

            this.ly_sales_receive_itemDetail_repairDetailTableAdapter.Connection.ConnectionString = SQLDatabase.Connectstring;



            this.dateTimePicker1.Text = DateTime.Today.AddMonths(-1).Date.ToString();
            this.dateTimePicker2.Text = DateTime.Today.AddDays(0).Date.ToString();

            this.dateTimePicker3.Text = DateTime.Today.AddMonths(-1).Date.ToString();
            this.dateTimePicker4.Text = DateTime.Today.AddDays(0).Date.ToString();

            this.dateTimePicker5.Text = DateTime.Today.AddMonths(-3).Date.ToString();
            this.dateTimePicker6.Text = DateTime.Today.AddDays(0).Date.ToString();



            string selAllString;

            if (SQLDatabase.CheckHaveRight(SQLDatabase.NowUserID, "营业维修综合信息"))
            {
                //selAllString = "SELECT  a.salesregion_code, a.salesregion_code+':'+a.salesregion_name as salesregion_name,b.yhbm,b.yhbm+':'+b.yhmc as yhmc FROM  ly_salesregion a left join T_users b on a.salesregion_code=b.salesregion_code ORDER BY  salesregion_code ";

                selAllString = " select distinct a.oper_dept as salesregion_code,a.oper_dept+':'+a.prodname as salesregion_name, b.yhbm ,b.yhbm+':'+b.yhmc as yhmc "
                               + " from ly_sales_repair_sum a left join "
                               + " (SELECT  yhmc , yhbm  FROM T_users WHERE (bumen = '000302')) b on a.workname=b.yhmc "
                               + "  where b.yhbm is not null order by a.oper_dept+':'+a.prodname,b.yhbm+':'+b.yhmc ";
            }
            else if (SQLDatabase.CheckHaveRight(SQLDatabase.NowUserID, "营业维修部门信息"))
            {
                selAllString = " select distinct a.oper_dept as salesregion_code,a.oper_dept+':'+a.prodname as salesregion_name, b.yhbm ,b.yhbm+':'+b.yhmc as yhmc "
                               + " from ly_sales_repair_sum a left join "
                               + " (SELECT  yhmc , yhbm  FROM T_users WHERE (bumen = '000302')) b on a.workname=b.yhmc "
                               + "  where b.yhbm is not null order by a.oper_dept+':'+a.prodname,b.yhbm+':'+b.yhmc ";
            }
            else
            {
                selAllString = " select distinct a.oper_dept as salesregion_code,a.oper_dept+':'+a.prodname as salesregion_name, b.yhbm ,b.yhbm+':'+b.yhmc as yhmc "
                               + " from ly_sales_repair_sum a left join "
                               + " (SELECT  yhmc , yhbm  FROM T_users WHERE (bumen = '000302')) b on a.workname=b.yhmc "
                               + "  where b.yhbm is not null and b.yhbm='" + SQLDatabase.NowUserID + "' order by a.oper_dept+':'+a.prodname,b.yhbm+':'+b.yhmc ";
            }


            SqlDataAdapter salesregionAdapter = new SqlDataAdapter(selAllString, SQLDatabase.Connectstring);

            DataSet salesregionData = new DataSet();

            salesregionAdapter.Fill(salesregionData);


            System.Windows.Forms.TreeNode TNode = new System.Windows.Forms.TreeNode();
            TNode.Text = "中原精密营业维修";

            if (SQLDatabase.CheckHaveRight(SQLDatabase.NowUserID, "营业维修综合信息"))
            {
                TNode.Tag = "";
            }
            else if (SQLDatabase.CheckHaveRight(SQLDatabase.NowUserID, "营业维修部门信息"))
            {
                TNode.Tag = "salesregion_code='" + SQLDatabase.nowSalesregioncode() + "'";
            }
            else
            {
                TNode.Tag = "salesperson_code='" + SQLDatabase.NowUserID + "'";
            }

            this.treeView1.Nodes.Add(TNode);

            MakeTreeView(salesregionData.Tables[0], null, TNode);

            this.treeView1.ExpandAll();

            if (SQLDatabase.CheckHaveRight(SQLDatabase.NowUserID, "营业维修综合信息"))
            {
                //this.treeView1.Visible = true;
                //this.splitContainer1.Panel1Collapsed = false;
            }
            else
            {
                //this.treeView1.Visible = false;
                //this.splitContainer1.Panel1Collapsed = true;
                this.nowfilterStr = "salesperson_code='" + SQLDatabase.NowUserID + "'";
            }

            //this.ly_sales_contract_main1DataGridView.SelectionChanged -= ly_sales_contract_main1DataGridView_SelectionChanged;
            //this.ly_sales_contract_main1TableAdapter.Fill(this.lYSalseMange.ly_sales_contract_main1,"","full" );
            //this.ly_sales_contract_main1DataGridView.SelectionChanged += ly_sales_contract_main1DataGridView_SelectionChanged;

            //SetViewState("View");
        }